title: How to use xpath to select a value in a drop down list located in a particular row?
body: <p>I am testing a page using selenium web driver. I have rows of data that represent 'requests', and in the last column of each of those rows the user can click a drop down list (with the option to either approve or reject) element that allows them to 'approve' or 'reject' the request. </p>
  
  <p>I need to be able to select the approve option on the drop down list of a row whose 'Name' column is equal to a variable (in this instance say the variable is 'John').</p>
  
  <p>In this test the user will be approving 'John's' request by selecting approve. How do I use xpath to ensure I am selecting the correct drop down element for the right person (right row)? Will I need to include a select element within an xpath somehow?</p>
  
  <p>An example of the select element method to select a drop down element:</p>
  
  <pre><code>new SelectElement(this.Driver.FindElement(By.Name("orm")).FindElement(By.Name("Tutors"))).SelectByText(tutorName);
  
  &lt;form name="RequestsForm" action="SubmitRequest.aspx" method="POST"&gt;
  &lt;h2 class="blacktext" align="center"&gt;Course approvals&lt;/h2&gt;
  &lt;table class="cooltable" width="90%" border="0" cellspacing="1" cellpadding="1"&gt;
  &lt;tbody&gt;
  &lt;tr&gt;
  &lt;td class="heading"&gt;
  &lt;b&gt;Name&lt;/b&gt;
  &lt;/td&gt;
  &lt;td class="heading"&gt;
  &lt;b&gt;Request Date&lt;/b&gt;
  &lt;/td&gt;
  &lt;td class="heading"&gt;
  &lt;b&gt;Approved&lt;/b&gt;
  &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;
  John
  &lt;input id="T1" type="text" value="888" name="T1"&gt;
  &lt;/td&gt;
  &lt;td&gt;1/3/2015&lt;/td&gt;
  &lt;td&gt;
  &lt;select id="D1" class="selecttext" size="1" name="D1"&gt;
  &lt;option&gt;?&lt;/option&gt;
  &lt;option value="Approved"&gt;Approved&lt;/option&gt;
  &lt;option&gt;Rejected&lt;/option&gt;
  &lt;/select&gt;
  &lt;/td&gt;
  &lt;/tr&gt;
  &lt;/tbody&gt;
  &lt;/table&gt;
  </code></pre>