• Empleos
  • Sobre nosotros
  • profesionales
    • Inicio
    • Empleos
    • Cursos y retos
    • Preguntas
    • Profesores
  • empresas
    • Inicio
    • Publicar vacante
    • Nuestro proceso
    • Precios
    • Pruebas Online
    • Nómina
    • Blog
    • Comercial
    • Calculadora de salario

0

140
Vistas
Selenium, WebDriver : Get Element, " <a href=Javascript " with changing variables

javascript button source to get element:

<a href="JavaScript:onclick=bookProsecc('20220512','1550','A','B','0','','')">
    <img src="/image/cal_app.jpg" alt="C">
</a>

I used find_element using href with just before changing variables but I think it doesn't work.

submit_btn = driver.find_element(By.XPATH,"//a[@href='JavaScript:onclick=bookProsecc(']")

What is the best way to access the button element?

almost 3 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

Try:

submit_btn = driver.find_element(By.XPATH,"//img[@src='/image/cal_app.jpg']/..")
almost 3 years ago · Juan Pablo Isaza Denunciar

0

submit_btn = driver.find_element(By.XPATH,"//a[starts-with(@href,'JavaScript:onclick=bookProsecc(')]")

Try this one where the href starts with a certain string.

almost 3 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 Nuestro proceso Comercial
Legal
Términos y condiciones Política de privacidad
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recomiéndame algunas ofertas
Necesito ayuda