title: How to click a link by text in Selenium web driver java
body: <p>I have many links in my page.One with text "Add policyhoder" ,one with text " Add" only and another "Add PP". I need to click link by text  .I am using below code to click link having text as "Add" only but it is clicking very first link having "Add" in its text i.e. ""Add PP" available on screen.Please can u help</p>
  
  <pre><code>Driver.findElement(By.linkText("Add"));
  </code></pre>
  
  <p><strong>My requirement is to click a link with exact text match . for example "Add" here</strong></p>
  
  <pre><code>&lt;td width="100%" colspan="7"&gt;
  &lt;table width="100%" cellspacing="0" cellpadding="1" valign="bottom"&gt;
  &lt;input id="hidPoClaim" type="hidden" onblur="ResetScript(this);" onfocus="HighlightScript(this);" value=" PolicySummary " callfunction="" size="" name="/Root/ACORD/InsuranceSvcRs/com.c_HomePolicyInquiryRs/co.cc_AvailableFunctions[com._FunctionName='PoSummary' and com.csc_FunctionName[@Action='ShowPolicyClaims']]"&gt;
  &lt;tbody&gt;
  &lt;tr&gt;
  &lt;td width="25%" valign="bottom" colspan="1"&gt;
  &lt;strong&gt;
  &lt;font class="flabel"&gt;Policy Claims History:&lt;/font&gt;
  &lt;/strong&gt;
  &lt;/td&gt;
  &lt;td width="20%" valign="bottom" colspan="1"&gt;
  &lt;font class="flabel"&gt;  &lt;/font&gt;
  &lt;a class="fLabel" onclick="INFCaptureControlID(this); DoLink('POLICYLOSS','','ADD' );return false; " onblur="ResetScript(this);return true;" onfocus="HighlightScript(this);" delimiter="|" screenaction="ADD" href="" screen="Y" objecttype="POLICYLOSS" type="Link" context="Screen"&gt;**Add**&lt;/a&gt;
  &lt;/td&gt;
  &lt;td width="20%" valign="bottom" colspan="1"&gt;
  &lt;td align="Center" width="15%" valign="bottom" colspan="1"&gt;
  &lt;td width="20%" colspan="1"&gt;
  &lt;/tr&gt;
  &lt;/tbody&gt;
  &lt;/table
  </code></pre>
  
  <p>Thanks
  Dev</p>