I'm trying to click on the button that contains the text "30 de novembro" but when I use my code it clicks on the "30 de outubro" button How to fix?
Here's the code I'm using
selecdia = navegador.find_element(by=By.LINK_TEXT, value='30')
selecdia.click()
sleep(1)
CodePudding user response:
Looks like the title attribute is the only way to uniquely identify the link you wish to click, therefore in Selenium 4 syntax:
selecdia = navegador.find_element(By.CSS_SELECTOR, "a[title='30 de novembro']")
or:
selecdia = navegador.find_element(By.XPATH, "//a[@title='30 de novembro']")