Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

425
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda