Reputation: 43
I am trying to find an element within a site, it is a Div class but the usual method is not working
div class ="subTabText"> Once Off < /div >
I have tried
driver.find_element_by_xpath("//div[contains(@class, 'Once Off')]")
but it cannot find it
Upvotes: 1
Views: 57
Reputation: 33371
In case the text "Once Off" is unique try this:
driver.find_element_by_xpath("//div[contains(text(), 'Once Off')]")
Upvotes: 2