title: Selenium C# - How to click on a link in a cell based on another cell in the same row?
body: <p>Using Selenium WEbdriver and C#, I am trying to click on a link in a cell based on the value in another cell. Here is the basic HTML:</p>
  
  <pre><code>&lt;table id="MainContent_gvInvoices"&gt;
  &lt;tbody&gt;
  &lt;tr&gt;
      &lt;td&gt;120109524&lt;/td&gt;
      &lt;td&gt;12345678&lt;/td&gt;
      &lt;td&gt;&lt;a href="javascript:__doPostBack('ctl00$MainContent$gvInvoices','Edit$0')"&gt;Edit&lt;/a&gt;&lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>
  
  <p>So, in the above HTML, first cell is lets say a Customer ID. The last cell in the same row is a link called 'Edit'. There could be multiple rows like these with different Customer Ids. I need to click on the Edit link based on a Customer ID. So far I have tried this with no luck:</p>
  
  <pre><code>public IWebElement testtable { get { return Driver.FindElement(By.Id("MainContent_gvInvoices")); } }
  public IList&lt;IWebElement&gt; rows { get { return testtable.FindElements(By.CssSelector("tbody tr td")); } }
  public IWebElement Edit { get { return Driver.FindElement(By.XPath("//*[@id='MainContent_gvInvoices']/tbody/tr[text() = '120109524']/td[3]/a")); } }
  </code></pre>
  
  <p>After this, <code>Edit.Click()</code> throws nusuchelement exception. How can I implement this?</p>