title: Need help locating/clicking a drop down located in table using selenium
body: <p>I am working on a script to locate/click a dropdown and the click any of the item from the selected drop down using selenium and python. </p>
  
  <p>Below is the code and would like your help to make it better if its correct and correct it if its not correct way of doing it.</p>
  
  <p>Code Snippet:</p>
  
  <pre><code>table1 = self.browser.find_element_by_id('user-list-table')
  trows = table1.find_elements_by_tag_name('tr')
  for trow in trows:
      tcols = trow.find_element_by_tag_name('td')
      for tcol in tcols:
          if tcol ==("//button[@id='dropdownMenu1'][3]"):
              self.browser.find_element_by_xpath(tcol).click()
              self.browser.find_element_by_link("//a[contains(text(),'Edit User')][3]").click()
  </code></pre>
  
  <p>HTML snippet :</p>
  
  <pre><code>&lt;table class="table table-bordered table-striped datatable" id="user-list-table"&gt;
                  &lt;thead&gt;
                      &lt;tr&gt;
                          &lt;th&gt;Status&lt;/th&gt;
                          &lt;th&gt;First Name&lt;/th&gt;
                          &lt;th&gt;Last Name&lt;/th&gt;
                          &lt;th&gt;Employee ID&lt;/th&gt;
                          &lt;th&gt;Patient Load&lt;br&gt;Permanent | Temporary&lt;/th&gt;
                          &lt;th&gt;No. of Tasks&lt;br&gt;Priority | Total&lt;/th&gt;
                          &lt;th&gt;Tasks Per Day (completed)&lt;br&gt;Week | Month | Quarter&lt;/th&gt;
                          &lt;th class="text-right"&gt;User Actions&lt;/th&gt;
                      &lt;/tr&gt;
                  &lt;/thead&gt;
                  &lt;tbody&gt;
                      &lt;tr class="odd"&gt;
                          &lt;td class="text-center"&gt;&lt;i class="status status-available"&gt;01&lt;/i&gt;&lt;/td&gt;
                          &lt;td&gt;Tracy&lt;/td&gt;
                          &lt;td&gt;Jones&lt;/td&gt;
                          &lt;td&gt;1001&lt;/td&gt;
                          &lt;td&gt;10 | 5&lt;/td&gt;
                          &lt;td&gt;30 | 50&lt;/td&gt;
                          &lt;td&gt;45 | 60 | 50&lt;/td&gt;
                          &lt;td class="text-right"&gt;
                              &lt;div class="dropdown"&gt;
                                &lt;button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-expanded="true"&gt;
                                  User Actions
                                  &lt;span class="caret"&gt;&lt;/span&gt;
                                &lt;/button&gt;
                                &lt;ul class="dropdown-menu dropdown-menu-right" role="menu"&gt;
                                  &lt;li role="presentation"&gt;&lt;a role="menuitem" tabindex="-1" href="patient-assignment.html"&gt;&lt;i class="fa fa-exchange"&gt;&lt;/i&gt; Assign Patients&lt;/a&gt;&lt;/li&gt;
                                  &lt;li role="presentation"&gt;&lt;a role="menuitem" tabindex="-1" href="#" data-toggle="modal" data-target="#User-Calendar-Today"&gt;&lt;i class="fa fa-calendar"&gt;&lt;/i&gt; Todays Availability&lt;/a&gt;&lt;/li&gt;
                                  &lt;li role="presentation"&gt;&lt;a role="menuitem" tabindex="-1" href="user-profile.html"&gt;&lt;i class="fa fa-user"&gt;&lt;/i&gt; View Profile&lt;/a&gt;&lt;/li&gt;
                                  &lt;li role="presentation"&gt;&lt;a role="menuitem" tabindex="-1" href="user-account.html"&gt;&lt;i class="fa fa-pencil"&gt;&lt;/i&gt; Edit User&lt;/a&gt;&lt;/li&gt;
                                  &lt;li role="presentation" class="divider"&gt;&lt;/li&gt;
                                  &lt;li role="presentation"&gt;&lt;a role="menuitem" tabindex="-1" href="#"&gt;&lt;i class="fa fa-times-circle"&gt;&lt;/i&gt; Deactivate User&lt;/a&gt;&lt;/li&gt;
                                &lt;/ul&gt;
                              &lt;/div&gt;
                          &lt;/td&gt;
                      &lt;/tr&gt;
  </code></pre>