0

I've tried to click the button "Continuar >>" multiples ways by now, but it simply wont work. I've no idea what I'm doing wrong. Any help?

driver = webdriver.Firefox()
driver.get('https://gru.inpi.gov.br/pePI/jsp/marcas/Pesquisa_classe_basica.jsp')
driver.find_element_by_xpath("//input[@type ='submit' and @title='Clique aqui para entrar na pesquisa']").click()

Edit adding the html of the element

<input type="submit" class="basic" value=" Continuar » " title="Clique aqui para entrar na Pesquisa">
Guy
  • 46,488
  • 10
  • 44
  • 88
  • What is the error ? Please share html of element you want click. – Muzzamil Jan 19 '20 at 14:53
  • Perhaps the following site can help: [can't click on the element in selenium](https://stackoverflow.com/questions/50810491/cant-click-on-the-element-in-selenium) – Noah.Ehrnstrom Jan 19 '20 at 14:54

2 Answers2

1

To click on the element with text as Continuar » you to induce WebDriverWait for the element_to_be_clickable() and you can use either of the following Locator Strategies:

  • Using CSS_SELECTOR:

    WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "input.basic[value=' Continuar » ']"))).click()
    
  • Using XPATH:

    WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//input[@class='basic' and @value=' Continuar » ']"))).click()
    
  • Note : You have to add the following imports :

    from selenium.webdriver.support.ui import WebDriverWait
    from selenium.webdriver.common.by import By
    from selenium.webdriver.support import expected_conditions as EC
    
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
1

As a quick solution, you can copy the xpath of the element by going to developer tools then right clicking on the element and then Copy> Copy XPath. This may break depending on your situation though.

from selenium import webdriver

driver = webdriver.Chrome()
driver.get('https://gru.inpi.gov.br/pePI/jsp/marcas/Pesquisa_classe_basica.jsp')
driver.find_element_by_xpath('//*[@id="principal"]/form/table/tbody/tr[3]/td/input').click()
Roofi
  • 82
  • 1
  • 3
  • 15