'Selenium Web driver: how do I click on image button without ID, NAME
Here is the image button source:
<div class="btn">
<a href="javascript:fncLogin();"><img src="/image/btn_login.jpg" alt="A_LOGIN"></a>
</div>
Solution 1:[1]
driver.find_element(By.XPATH,"//a[@href='javascript:fncLogin();']").click()
You can use it's href.
If it's button class is unique you can do
driver.find_element(By.XPATH,"//div[@class='btn']/a").click()
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Arundeep Chohan |
