title: How do we find the table row containing a specific text when "data-row-index" is not explicitly given
body: <p>I use the following code to locate the table row containing the text.</p>
  
  <pre><code>WebElement table = driver.findElement(By.xpath("//tr[td[contains(text(),'Row 1, Column 1')]]")); 
  String dataRowIndex = table.getAttribute("data-row-index");
  System.out.println(dataRowIndex);
  </code></pre>
  
  <p>I am using this site  </p>
  
  <pre><code>String URL="http://www.tutorialspoint.com/html/html_tables.htm";
  driver.navigate().to(URL);
  </code></pre>
  
  <p>with following html codes.</p>
  
  <pre><code>&lt;table border="1" style="border-collapse: separate; border-spacing: 1px;"&gt;
  &lt;tr&gt;
  &lt;td&gt;Row 1, Column 1&lt;/td&gt;
  &lt;td&gt;Row 1, Column 2&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;Row 2, Column 1&lt;/td&gt;
  &lt;td&gt;Row 2, Column 2&lt;/td&gt;
  &lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>It is returning null since there is no "data-row-index" explicitly given. How can we identify the row number in the table.
  Thanks.</p>