Xpath for href element

cxyz picture cxyz · Oct 29, 2012 · Viewed 135.1k times · Source

I need to click on the below href element,which is present among similar href elements.

<a id="oldcontent" href="listDetails.do?camp=1865"><u>Re-Call</u></a>

Can anyone provide me xpath to click the above href link?Thanks in advance for help

Answer

Santoshsarma picture Santoshsarma · Oct 29, 2012

Try below locator.

selenium.click("css=a[href*='listDetails.do'][id='oldcontent']");

or

selenium.click("xpath=//a[contains(@href,'listDetails.do') and @id='oldcontent']");