Skip to content
Advertisement

Python selenium: finding multiple elements with partially different names

I have a webpage full of elements that consists below example (gave 2, the webpage consists of around >10), I want to search for all of the below elements containing ‘suda-data’ and click on all of them. Howvever I am unable to define the finding of all the elements properly.

Notes:

a. cannot search by class=”S_txt2″ (will include elements that is out of the criteria)

b.The numbers at the back of ‘suda-data’ changes everytime the page is refreshed.

JavaScript

…….

JavaScript

Any way that i can find all the elements containing this? Thanks for the help.

Advertisement

Answer

Try this on your actual html and see if it works:

JavaScript

For a page containing just the two <a> elements in your question, the output should be:

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement