6

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

1 Answer 1

11

Try this:

driver.find_element_by_xpath('//div[text()="%s"]' % variable)
Sign up to request clarification or add additional context in comments.

1 Comment

Sure, it's python, simple is better than complex :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.