i'm trying to find with selenium in python a button in a website and the button identify is: AB 12
I'm trying with this code but all can't find the button...
driver.find_element_by_xpath("//button[contains(@class, '.size-grid-dropdown .size-grid-button') and contains(.,'AB 12)]")
driver.find_element_by_xpath('//button[span[text()="AB 12"]')
driver.find_element_by_link_text("AB 12")
the problem is: i have a lot of button with same class but different AB 12 / AB 23 / AB 34...
How can i find a precisely button?
Thanks!
//button[text()="AB 12"]work? It's a modified version of the second one you tried, without the span.