title: Selenium XPATH how to select checkbox from a table where name is in column 2 and name in column 4
body: <p>I have a HTML table with some rows and columns.  I would like to select the <strong>checkbox</strong> where there is the <strong>text "Name" in column 2</strong> and the <strong>text "crm" is in column 4</strong></p>
  
  <p>The sample HTML is:</p>
  
  <pre><code>&lt;table id="data_configuration_mappings_ct_fields_body" cellspacing="0" style="table-layout: fixed; width: 100%;"&gt;
  &lt;colgroup&gt;
  &lt;tbody&gt;
  &lt;tr class="GJPPK2LBFG GJPPK2LBMG GJPPK2LBPG" __gwt_subrow="0" __gwt_row="0"&gt;
      &lt;td class="GJPPK2LBEG GJPPK2LBGG GJPPK2LBHG GJPPK2LBNG GJPPK2LBAH"&gt;
          &lt;div __gwt_cell="cell-gwt-uid-388" style="outline-style:none;"&gt;
              &lt;input type="checkbox" tabindex="-1"/&gt;
          &lt;/div&gt;
      &lt;/td&gt;
      &lt;td class="GJPPK2LBEG GJPPK2LBGG GJPPK2LBNG GJPPK2LBOG GJPPK2LBAH"&gt;
          &lt;div __gwt_cell="cell-gwt-uid-389" style="outline-style:none;" tabindex="0"&gt;
              &lt;span class="linkhover" title="Name"
                    style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;empty-cells:show;display:block;color:#00A;cursor:pointer;"&gt;Name&lt;/span&gt;
          &lt;/div&gt;
      &lt;/td&gt;
      &lt;td class="GJPPK2LBEG GJPPK2LBGG GJPPK2LBNG GJPPK2LBAH"&gt;
          &lt;div __gwt_cell="cell-gwt-uid-390" style="outline-style:none;"&gt;
              &lt;span class="" title="Name"
                    style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;empty-cells:show;display:block;padding-right: 1px;"&gt;Name&lt;/span&gt;
          &lt;/div&gt;
      &lt;/td&gt;
      &lt;td class="GJPPK2LBEG GJPPK2LBGG GJPPK2LBNG GJPPK2LBAH"&gt;
          &lt;div __gwt_cell="cell-gwt-uid-391" style="outline-style:none;"&gt;
              &lt;span class="" title="crm"
                    style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;empty-cells:show;display:block;padding-right: 1px;"&gt;crm&lt;/span&gt;
          &lt;/div&gt;
      &lt;/td&gt;
      &lt;td class="GJPPK2LBEG GJPPK2LBGG GJPPK2LBNG GJPPK2LBAH"&gt;
          &lt;div __gwt_cell="cell-gwt-uid-392" style="outline-style:none;"&gt;
              &lt;span class="" title="Main"
                    style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;empty-cells:show;display:block;padding-right: 1px;"&gt;Main&lt;/span&gt;
          &lt;/div&gt;
      &lt;/td&gt;
      &lt;td class="GJPPK2LBEG GJPPK2LBGG GJPPK2LBNG GJPPK2LBAH"&gt;
          &lt;div __gwt_cell="cell-gwt-uid-393" style="outline-style:none;"&gt;
              &lt;span class="" title="TITLE + FNAME + SNAME + GENDER"
                    style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;empty-cells:show;display:block;padding-right: 1px;"&gt;TITLE + FNAME + SNAME + GENDER&lt;/span&gt;
          &lt;/div&gt;
      &lt;/td&gt;
      &lt;td class="GJPPK2LBEG GJPPK2LBGG GJPPK2LBNG GJPPK2LBAH"&gt;
          &lt;div __gwt_cell="cell-gwt-uid-394" style="outline-style:none;"&gt;
              &lt;span class="" title="CRM"
                    style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;empty-cells:show;display:block;padding-right: 1px;"&gt;CRM&lt;/span&gt;
          &lt;/div&gt;
      &lt;/td&gt;
      &lt;td class="GJPPK2LBEG GJPPK2LBGG GJPPK2LBNG GJPPK2LBAH"&gt;
          &lt;div __gwt_cell="cell-gwt-uid-395" style="outline-style:none;"&gt;
              &lt;span class="" title="DM"
                    style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;empty-cells:show;display:block;padding-right: 1px;"&gt;DM&lt;/span&gt;
          &lt;/div&gt;
      &lt;/td&gt;
      &lt;td class="GJPPK2LBEG GJPPK2LBGG GJPPK2LBBH GJPPK2LBNG GJPPK2LBAH"&gt;
          &lt;div __gwt_cell="cell-gwt-uid-396" style="outline-style:none;"&gt;
              &lt;span class="" title=""
                    style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;empty-cells:show;display:block;padding-right: 1px;"/&gt;
          &lt;/div&gt;
      &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr class="GJPPK2LBEH" __gwt_subrow="0" __gwt_row="1"&gt;
  &lt;tr class="GJPPK2LBFG" __gwt_subrow="0" __gwt_row="2"&gt;
  &lt;tr class="GJPPK2LBEH" __gwt_subrow="0" __gwt_row="3"&gt;
  &lt;tr class="GJPPK2LBFG" __gwt_subrow="0" __gwt_row="4"&gt;
  &lt;tr class="GJPPK2LBEH" __gwt_subrow="0" __gwt_row="5"&gt;
  &lt;tr class="GJPPK2LBFG" __gwt_subrow="0" __gwt_row="6"&gt;
      &lt;td class="GJPPK2LBEG GJPPK2LBGG GJPPK2LBHG"&gt;
          &lt;div __gwt_cell="cell-gwt-uid-388" style="outline-style:none;"&gt;
              &lt;input type="checkbox" tabindex="-1"/&gt;
          &lt;/div&gt;
      &lt;/td&gt;
      &lt;td class="GJPPK2LBEG GJPPK2LBGG"&gt;
          &lt;div __gwt_cell="cell-gwt-uid-389" style="outline-style:none;"&gt;
              &lt;span class="linkhover" title="Name"
                    style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;empty-cells:show;display:block;color:#00A;cursor:pointer;"&gt;Name&lt;/span&gt;
          &lt;/div&gt;
      &lt;/td&gt;
      &lt;td class="GJPPK2LBEG GJPPK2LBGG"&gt;
          &lt;div __gwt_cell="cell-gwt-uid-390" style="outline-style:none;"&gt;
              &lt;span class="" title="Name"
                    style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;empty-cells:show;display:block;padding-right: 1px;"&gt;Name&lt;/span&gt;
          &lt;/div&gt;
      &lt;/td&gt;
      &lt;td class="GJPPK2LBEG GJPPK2LBGG"&gt;
          &lt;div __gwt_cell="cell-gwt-uid-391" style="outline-style:none;"&gt;
              &lt;span class="" title="crm2"
                    style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;empty-cells:show;display:block;padding-right: 1px;"&gt;crm2&lt;/span&gt;
          &lt;/div&gt;
      &lt;/td&gt;
      &lt;td class="GJPPK2LBEG GJPPK2LBGG"&gt;
          &lt;div __gwt_cell="cell-gwt-uid-392" style="outline-style:none;"&gt;
              &lt;span class="" title="Main"
                    style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;empty-cells:show;display:block;padding-right: 1px;"&gt;Main&lt;/span&gt;
          &lt;/div&gt;
      &lt;/td&gt;
      &lt;td class="GJPPK2LBEG GJPPK2LBGG"&gt;
          &lt;div __gwt_cell="cell-gwt-uid-393" style="outline-style:none;"&gt;
              &lt;span class="" title="TITLE + FNAME + SNAME"
                    style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;empty-cells:show;display:block;padding-right: 1px;"&gt;TITLE + FNAME + SNAME&lt;/span&gt;
          &lt;/div&gt;
      &lt;/td&gt;
      &lt;td class="GJPPK2LBEG GJPPK2LBGG"&gt;
          &lt;div __gwt_cell="cell-gwt-uid-394" style="outline-style:none;"&gt;
              &lt;span class="" title="CRM"
                    style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;empty-cells:show;display:block;padding-right: 1px;"&gt;CRM&lt;/span&gt;
          &lt;/div&gt;
      &lt;/td&gt;
      &lt;td class="GJPPK2LBEG GJPPK2LBGG"&gt;
          &lt;div __gwt_cell="cell-gwt-uid-395" style="outline-style:none;"&gt;
              &lt;span class="" title="DM"
                    style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;empty-cells:show;display:block;padding-right: 1px;"&gt;DM&lt;/span&gt;
          &lt;/div&gt;
      &lt;/td&gt;
      &lt;td class="GJPPK2LBEG GJPPK2LBGG GJPPK2LBBH"&gt;
  &lt;/tr&gt;
  &lt;tr class="GJPPK2LBEH" __gwt_subrow="0" __gwt_row="7"&gt;
  &lt;tr class="GJPPK2LBFG" __gwt_subrow="0" __gwt_row="8"&gt;
  &lt;tr class="GJPPK2LBEH" __gwt_subrow="0" __gwt_row="9"&gt;
  &lt;tr class="GJPPK2LBFG" __gwt_subrow="0" __gwt_row="10"&gt;
  &lt;tr class="GJPPK2LBEH" __gwt_subrow="0" __gwt_row="11"&gt;
  &lt;tr class="GJPPK2LBFG" __gwt_subrow="0" __gwt_row="12"&gt;
  &lt;tr class="GJPPK2LBEH" __gwt_subrow="0" __gwt_row="13"&gt;
  &lt;/tbody&gt;
  </code></pre>
  
  <p></p>
  
  <p>To start off with I can get the column 2 highlighted in Xpath checker in Firefox with the following Xpath:</p>
  
  <pre><code>//table[@id="data_configuration_mappings_ct_fields_body"]//tr//td[2]
  </code></pre>
  
  <p>I do not know how to proceed and get the text Name from column 2 and the text crm from column 4</p>
  
  <p>I can get the text Name from column 1 using the following XPath.  How do i also include the text crm from column 4?</p>
  
  <pre><code>//table[@id="data_configuration_mappings_ct_fields_body"]//tr//td[2]//span[text()="Name"]
  </code></pre>
  
  <p>I need some help please.</p>
  
  <p>Thanks, Riaz</p>