title: BeautifulSoup extract data from certain columns from a table I am getting too much data out
body: <p>I am trying to extract some data out of my Selenium Test Report html file.<br>
  I am getting too much data out of the table of rows and columns.
  The data I would like to extract is all columns which have the class value "testcase" and there is a column below with a class value "popup_link" and the text value will say Pass or Fail.
  E.g.</p>
  
  <pre><code>&lt;td class='none'&gt;&lt;div class='testcase'&gt;test_000001_login_valid_user&lt;/div&gt;&lt;/td&gt;
  &lt;a class="popup_link" onfocus='this.blur();' href="javascript:showTestDetail('div_pt1.1')" &gt;
      pass&lt;/a&gt;
  </code></pre>
  
  <p>I would like the text "test_000001_login_valid_user" and the text "pass"</p>
  
  <p>There are lots of test cases in my report so I would like to iterate over the rows and get the test case name out and the pass or fail text.</p>
  
  <p>My HTML snippet is:</p>
  
  <pre><code>    &lt;table id='result_table'&gt;
  &lt;colgroup&gt;
  &lt;col align='left' /&gt;
  &lt;col align='right' /&gt;
  &lt;col align='right' /&gt;
  &lt;col align='right' /&gt;
  &lt;col align='right' /&gt;
  &lt;col align='right' /&gt;
  &lt;/colgroup&gt;
  &lt;tr id='header_row'&gt;
      &lt;td&gt;Test Group/Test case&lt;/td&gt;
      &lt;td&gt;Count&lt;/td&gt;
      &lt;td&gt;Pass&lt;/td&gt;
      &lt;td&gt;Fail&lt;/td&gt;
      &lt;td&gt;Error&lt;/td&gt;
      &lt;td&gt;View&lt;/td&gt;
  &lt;/tr&gt;
  
  &lt;tr class='passClass'&gt;
      &lt;td&gt;Regression_TestCase.RegressionProjectEdit_TestCase.RegressionProject_TestCase_Project_Edit&lt;/td&gt;
      &lt;td&gt;75&lt;/td&gt;
      &lt;td&gt;75&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;&lt;a href="javascript:showClassDetail('c1',75)"&gt;Detail&lt;/a&gt;&lt;/td&gt;
  &lt;/tr&gt;
  
  &lt;tr id='pt1.1' class='hiddenRow'&gt;
      &lt;td class='none'&gt;&lt;div class='testcase'&gt;test_000001_login_valid_user&lt;/div&gt;&lt;/td&gt;
      &lt;td colspan='5' align='center'&gt;
  
      &lt;!--css div popup start--&gt;
      &lt;a class="popup_link" onfocus='this.blur();' href="javascript:showTestDetail('div_pt1.1')" &gt;
          pass&lt;/a&gt;
  
      &lt;div id='div_pt1.1' class="popup_window"&gt;
          &lt;div style='text-align: right; color:red;cursor:pointer'&gt;
          &lt;a onfocus='this.blur();' onclick="document.getElementById('div_pt1.1').style.display = 'none' " &gt;
             [x]&lt;/a&gt;
          &lt;/div&gt;
          &lt;pre&gt;
  
  pt1.1: *** test_login_valid_user ***
  test login with a valid user - Passed
  
  
          &lt;/pre&gt;
      &lt;/div&gt;
      &lt;!--css div popup end--&gt;
  
      &lt;/td&gt;
  &lt;/tr&gt;
  
  &lt;tr id='pt1.2' class='hiddenRow'&gt;
      &lt;td class='none'&gt;&lt;div class='testcase'&gt;test_000002_select_a_project&lt;/div&gt;&lt;/td&gt;
      &lt;td colspan='5' align='center'&gt;
  
      &lt;!--css div popup start--&gt;
      &lt;a class="popup_link" onfocus='this.blur();' href="javascript:showTestDetail('div_pt1.2')" &gt;
          pass&lt;/a&gt;
  
      &lt;div id='div_pt1.2' class="popup_window"&gt;
          &lt;div style='text-align: right; color:red;cursor:pointer'&gt;
          &lt;a onfocus='this.blur();' onclick="document.getElementById('div_pt1.2').style.display = 'none' " &gt;
             [x]&lt;/a&gt;
          &lt;/div&gt;
          &lt;pre&gt;
  
  pt1.2: *** test_login_valid_user ***
  test login with a valid user - Passed
  *** test_select_a_project ***
  08_12_1612_08_03
  Selenium_Regression_Edit_Project_Test
  
  
          &lt;/pre&gt;
      &lt;/div&gt;
      &lt;!--css div popup end--&gt;
  
      &lt;/td&gt;
  &lt;/tr&gt;
  
  &lt;tr id='pt1.3' class='hiddenRow'&gt;
      &lt;td class='none'&gt;&lt;div class='testcase'&gt;test_000003_verify_Lademo_CRM_DataPreview_is_present&lt;/div&gt;&lt;/td&gt;
      &lt;td colspan='5' align='center'&gt;
  
      &lt;!--css div popup start--&gt;
      &lt;a class="popup_link" onfocus='this.blur();' href="javascript:showTestDetail('div_pt1.3')" &gt;
          pass&lt;/a&gt;
  
      &lt;div id='div_pt1.3' class="popup_window"&gt;
          &lt;div style='text-align: right; color:red;cursor:pointer'&gt;
          &lt;a onfocus='this.blur();' onclick="document.getElementById('div_pt1.3').style.display = 'none' " &gt;
             [x]&lt;/a&gt;
          &lt;/div&gt;
          &lt;pre&gt;
  
  pt1.3: *** test_login_valid_user ***
  test login with a valid user - Passed
  *** test_select_a_project ***
  08_12_1612_08_03
  Selenium_Regression_Edit_Project_Test
  *** Test verify_Lademo_CRM_DataPreview_is_present ***
  aSelenium_LADEMO_CRM_DONOTCHANGE
  File
  498
  
  
          &lt;/pre&gt;
      &lt;/div&gt;
      &lt;!--css div popup end--&gt;
  
      &lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>
  
  <p>My code is:</p>
  
  <pre><code>from bs4 import BeautifulSoup
  
  table = soup.select_one("#result_table")
  
  for row in table.select("tr.hiddenRow"):
          print(" ".join([td.text for td in row.find_all("td")]))
  </code></pre>
  
  <p>How can i achieve this please?</p>
  
  <p>Thanks, Riaz</p>