Monday 15 April 2013

python - how to use a variable in selenium webdriver find element by xpath? -


So I have a variable named folder containing a string that I randomly generate. I want to use xpath to search for this folder by name, and I'm not sure how to implement it

  driver.find_element_by_xpath ('// div [text () = 'Variable'] ')   

Where the variable contains random text, it will happen with SQL (* select * from the table where the value = (?)), [Variable] ... or Something similar

try this:

  driver.find_element_by_xpath ( '// div [text () ='% s ']'% variable)    

No comments:

Post a Comment