Reputation: 1
I am struggling to refer to these buttons which are identical, except for one thing which is the #text (in this case 'Sportart'). There are no ID's or anything else that might define these buttons reliably.
Here's the code.
<button type="button" class="btn btn--anchor sticky bg-translucent text-uppercase pdgx sm-pdg text-h3 w-100"> Sportart <svg role="img" class="icon icon--arrow-down icon--toggle bg-brand text-white"><use xlink:href="#arrow-down"></use></svg></button>
Any help is really appreciated :)
Upvotes: 0
Views: 28
Reputation: 33384
You can use the following xpath
to identify the button.
driver.find_element(By.XPATH, "//button[contains(.,'Sportart')]")
or
driver.find_element(By.XPATH, "//button[normalize-space(.)='Sportart']")
Upvotes: 1