2

I currently have a script that can find the first element with the link text "Toast" using

toast_link = driver.find_element_by_link_text('Toast')

The problem I am having is that there are multiple instances of the link text "Toast" and I would like to iterate through all of them. What is the best way to do this?

1 Answer 1

5

To find multiple elements, use find_elements_* instead of find_element_* (NOTE: s):

toast_links = driver.find_elements_by_link_text('Toast')
for link in toast_links:
    ....
Sign up to request clarification or add additional context in comments.

1 Comment

Didn't know that was a possibility, I guess I read over it when I was looking it up. Thanks, this was quite easy!

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.