Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

254
Views
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?

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Try:

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

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.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!