1

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

2
  • 1
    You are looking for class to contain Once Off but the class is subTabText. Commented May 20, 2021 at 23:09
  • The problem is there is # buttons with the same class name only difference between the 3 is where it says "Once Off' Commented May 21, 2021 at 11:56

1 Answer 1

2

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

driver.find_element_by_xpath("//div[contains(text(), 'Once Off')]")
Sign up to request clarification or add additional context in comments.

Comments

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.