Garret Dabner
Garret Dabner

Reputation: 43

Finding an element for selenium

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

Answers (1)

Prophet
Prophet

Reputation: 33371

In case the text "Once Off" is unique try this:

driver.find_element_by_xpath("//div[contains(text(), 'Once Off')]")

Upvotes: 2

Related Questions