Selenium - Multiple anchor - Same ID - Not able to fetch -
i want click on anchor tag class id clsarrowclick , same id on anchor tag.
<td class="text-center" style="width: 25% !important;"> <td class="arrow" data-toggle="tooltip" data-container="body" title="" style="width: 25% !important; text-align:center" data-original- title="select/show data"> **<a id="clsarrowclick" class="clsarrowclick" href="#" onclick="javascript:openaddnewwellpopup(this);"> <i class="fa fa-arrow-right"/> </a>** <input id="hdnissaved0" class="hdnisarrowsaved" value="0" type="hidden"/> </td> </tr> <tr id="2"> <td style="width:50%; class=" '="" data-container="body" data- toggle="tooltip" title="" data-original-title="abcd">abcd</td> <td class="text-center" style="width: 25% !important;"> <td class="arrow" data-toggle="tooltip" data-container="body" title="" style="width: 25% !important; text-align:center" data-original- title="select/show data"> **<a id="clsarrowclick" class="clsarrowclick" href="#" onclick="javascript:openaddnewpopup(this);"> <i class="fa fa-arrow-right"/> </a>** <input id="hdnissaved1" class="hdnisarrowsaved" value="0" type="hidden"/> </td>
i tried list, wait method , simple way everything, program throws error exception in thread "main" org.openqa.selenium.elementnotvisibleexception
like
//webdriverwait wait = new webdriverwait(driver,30); //wait.until(expectedconditions.presenceofelementlocated(by.classname("clsarrowclick"))); //driver.findelement(by.classname("clsarrowclick")); driver.findelement(by.xpath("(.//*[@id='clsarrowclick'])[1]")).click();
try following xpaths might work second link. haven't tested , don't know whole html of page said might.
//a[@id='clsarrowclick'][2]
or 1
//input[@id='hdnissaved1']../a[@id='clsarrowclick']
or following if interested in clickin first link
//td[@class='arrow']/a[@id='clsarrowclick']
Comments
Post a Comment