How to click a link inside a webtable using WebDriver -


the following code html

<table cellspacing="0" cellpadding="0" border="0" width="192">   <tbody>     <tr>     </tr>     <tr>       <td class="rhs-customer" valign="top">         <p>         </p>         <p>           <img hspace="6" align="left" alt="" src="../common/images/icon-contactus.gif">           <a onclick="window.open('../applications/homeline.asp','homelinenumber','height=500, width=700,scrollbars=yes,resizable=1,top=0,left=0')" href="#">&nbsp;**call us**</a>         </p>         <p>         </p>       </td>     </tr>   </tbody> </table> 

i want click on link "call us", if please help, i'm new webdriver.

i using below xpath attempt clicking link, thrown nosuchelementexception.

driver.findelement(by.xpath("html/body/table/tbody/tr[2]/td/table/tbody/tr/td[3]/table/tbody/tr/td/table/tbody/tr[1]/td/table/tbody/tr[2]/td/p[2]/a")).click(); 

try this

driver.findelement(by.partiallinktext("call us")).click(); 

Comments