J. K. J. K. - 3 years ago 135
Java Question

Webdriver/Java/Xpath: How can I click the second "Login" link

How can I use an xpath expression to tell Selenium Webdriver to click the second "Login" link on a page?

OR:

How can I convert this to an absolute xpath

(//input[@name='commit'])[2]

Answer Source

Open the webpage in Chrome, Inspect the element, right click on the highlighted node and click Copy XPath.

It should look something like:

//a[text()="Login"]
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download