What is wrong with this Xpath?

Delta223

Junior Member
Joined
Mar 1, 2010
Messages
146
Reaction score
13
This is python 2.7 with Selenium:

driver.find_element_by_xpath("//form[contains(@id, 'log')]//input[@type='submit' and contains(lower-case(text(), 'log'))]").click()

And it's targeting the log in button on Facebook.com. I think the syntax is off somewhere but not sure.
 
I dont know whats wrong with it but you could surely make it much easier something on the lines of
Code:
"//*[@id='id_of_the_element']"
As long as its unique pick whatever atribute you find
 
I'm trying to create more flexible matching patterns. Facebook uses a lot of dynamic classes with no id attributes when logged in
 
use imacros to record the path then use it to your selenium code
 
Back
Top