title: how to find inner element of table by element.findElements[n].findElement()
body: <p>For the below HTML code</p>
  <pre><code>&lt;table class=&quot;table&quot; id=&quot;Table1&quot; xpath=&quot;1&quot;&gt;
     &lt;thead&gt;
        &lt;tr class=&quot;table-header&quot;&gt;      &lt;/tr&gt;
     &lt;/thead&gt;
     &lt;tbody&gt;
        &lt;tr class=&quot;table-row&quot;&gt;
           &lt;span&gt;&lt;i data-icon=&quot;&quot; class=&quot;icon fa fa-pencil fa-1x&quot; id=&quot;l2_0-0-Edit_Icon&quot;&gt;&lt;/i&gt;&lt;/span&gt;
        &lt;/tr&gt;
        &lt;tr class=&quot;table-row&quot;&gt;
           &lt;span&gt;&lt;i data-icon=&quot;&quot; class=&quot;icon fa fa-pencil fa-1x&quot; id=&quot;l2_0-0-Edit_Icon&quot;&gt;&lt;/i&gt;&lt;/span&gt;
        &lt;/tr&gt;
        &lt;tr class=&quot;table-row&quot;&gt;
           &lt;span&gt;&lt;i data-icon=&quot;&quot; class=&quot;icon fa fa-pencil fa-1x&quot; id=&quot;l2_0-0-Edit_Icon&quot;&gt;&lt;/i&gt;&lt;/span&gt;
        &lt;/tr&gt;
        &lt;tr class=&quot;table-row&quot;&gt;
           &lt;span&gt;&lt;i data-icon=&quot;&quot; class=&quot;icon fa fa-pencil fa-1x&quot; id=&quot;l2_0-0-Edit_Icon&quot;&gt;&lt;/i&gt;&lt;/span&gt;
        &lt;/tr&gt;
        &lt;tr class=&quot;table-row&quot;&gt;
           &lt;span&gt;&lt;i data-icon=&quot;&quot; class=&quot;icon fa fa-pencil fa-1x&quot; id=&quot;l2_0-0-Edit_Icon&quot;&gt;&lt;/i&gt;&lt;/span&gt;
        &lt;/tr&gt;
     &lt;/tbody&gt;
  &lt;/table&gt;
  &lt;pre&gt;
  </code></pre>
  <p>Suppose I need to click Edit Button on 4th row .. I can use following code. (This code is working fine)</p>
  <p><code>Driver.FindElement(By.XPath(&quot;//table[@id='Table1']//tr[3]//i[contains(@id,'Edit_Icon')]&quot;)).Click()</code></p>
  <p>The Problem is Edit Button may not always exist on 1st, 2nd or 3rd row. (Its dynamic based on diff conditions)</p>
  <pre><code>&lt;table class=&quot;table&quot; id=&quot;Table1&quot; xpath=&quot;1&quot;&gt;
     &lt;thead&gt;
        &lt;tr class=&quot;table-header&quot;&gt;      &lt;/tr&gt;
     &lt;/thead&gt;
     &lt;tbody&gt;
        &lt;tr class=&quot;table-row&quot;&gt;
           &lt;span&gt;&lt;i data-icon=&quot;&quot; class=&quot;icon fa fa-pencil fa-1x&quot; id=&quot;l2_0-0-Edit_Icon&quot;&gt;&lt;/i&gt;&lt;/span&gt;
        &lt;/tr&gt;
        &lt;tr class=&quot;table-row&quot;&gt;
           
        &lt;/tr&gt;
        &lt;tr class=&quot;table-row&quot;&gt;
           &lt;span&gt;&lt;i data-icon=&quot;&quot; class=&quot;icon fa fa-pencil fa-1x&quot; id=&quot;l2_0-0-Edit_Icon&quot;&gt;&lt;/i&gt;&lt;/span&gt;
        &lt;/tr&gt;
        &lt;tr class=&quot;table-row&quot;&gt;
           &lt;span&gt;&lt;i data-icon=&quot;&quot; class=&quot;icon fa fa-pencil fa-1x&quot; id=&quot;l2_0-0-Edit_Icon&quot;&gt;&lt;/i&gt;&lt;/span&gt;
        &lt;/tr&gt;
        &lt;tr class=&quot;table-row&quot;&gt;
           
        &lt;/tr&gt;
     &lt;/tbody&gt;
  &lt;/table&gt;
  </code></pre>
  <p>Hence i am trying to follow below code, and then change &quot;3&quot; as per need.
  (I am trying to do is find the 3row and within that i am trying to find Edit Icon).
  But its not working.</p>
  <p>How i can i write an Xpath that always clicks on the row i wanted, irrespective of other rows has &quot;Edit&quot; button or not?</p>
  <pre><code>Driver.FindElement(By.XPath(&quot;//table[@id='Table1']&quot;)).FindElements(By.XPath(&quot;//tr&quot;))[3].FindElement(By.XPath(&quot;//i[contains(@id,'Edit_Icon')]&quot;)).Click()
  </code></pre>