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
asked Jun 20, 2013 at 20:18
gallly
1,2114 gold badges27 silver badges46 bronze badges
1 Answer 1
Try this:
driver.find_element_by_xpath('//div[text()="%s"]' % variable)
answered Jun 20, 2013 at 20:22
alecxe
476k127 gold badges1.1k silver badges1.2k bronze badges
Sign up to request clarification or add additional context in comments.
1 Comment
alecxe
Sure, it's python, simple is better than complex :)
lang-py