Reputation: 1211
so I have a variable named folder which contains a string that I randomly generate. I want to use xpath to find this folder by name, and I am not sure how to put this into action
driver.find_element_by_xpath('//div[text()="variable"]')
where variable contains the randomized text. With sql it would be like this (select * from table where value =(?)), [variable] ...or something similar
Upvotes: 6
Views: 9683
Reputation: 474171
Try this:
driver.find_element_by_xpath('//div[text()="%s"]' % variable)
Upvotes: 11