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?
CodePudding user response:
Try:
submit_btn = driver.find_element(By.XPATH,"//img[@src='/image/cal_app.jpg']/..")
CodePudding user response:
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.