Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

430
Visualizações
Can't press a phenomenical easy button with selenium python

I need some help with pressing this button. In this page the button "cersa" is untraceable with selectors.

https://www.consiglionazionaleforense.it/ricerca-avvocati

I also used JS code that in the console it works but in the python script it crashes with:

selenium.common.exceptions.JavascriptException: Message: javascript error: Cannot read properties of undefined (reading 'click')

the js script:

    js_code = "button = document.getElementsByClassName('btn-link btn-link--green mt-4'); button[0].click();"
    driver.execute_script(js_code)
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

This should work

   driver.execute_script("document.getElementsByClassName('btn-link btn-link--green mt-4').click()")

I am not sure why you are intending to go with execute_script, but if you can go with the direct selenium, then you may use this:

driver.find_element(By.XPATH, "//div[@id='ricerca-avvocati']//button[@type='submit']").click()

UPDATE:

I did a keen testing on the issue of why the button is not clicking even though the element is found in the DOM.

The issue is, the element is not clickable at all, unless you click on the I am not a robot checkbox, which if clicked by automation (or a bot) may not work (as websites detect the bot actions). Try clicking on the reCaptcha I am not a robot checkbox, and if you are not detected as a bot, then the element would become clickable and the action would be fulfilled.

I used regular click function - the one that I gave you as a second code block, and it works, but I had to manually force click on the reCaptcha checkbox - only then it worked. As you can see, the code exited with 0 code, which mean no errors. But the caveat is the reCaptcha handling, which is quite harder with a bot/selenium

Process finished with exit code 0
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda