title: Python Selenium: Extracting dynamic tables from nested classes
body: <p>I'm trying to retrieve data from two tables whose data gets updated every <code>0.5</code> seconds, the table is present in the nested class structure. I have used Selenium's <code>driver.find_element_by_xpath</code> and tried to get the data by a sequence of <code>div[contains(@class,one)]/div[contains(@class,two)]...</code> but in vain. </p>
  
  <p>I tried its other available methods and searched for other resources but could not get any close. </p>
  
  <p>Any leads! Here's the HTML code:</p>
  
  <pre><code>&lt;body&gt;
  &lt;div class="one"&gt; 
      &lt;div class="two"&gt;
          &lt;div class="three"&gt;
  
              &lt;!--- First table --&gt;
  
              &lt;table class="Jan"&gt;
                  &lt;thread&gt;...&lt;/thread&gt;
                  &lt;tbody&gt;
                      &lt;tr&gt;
                          &lt;td class='cost'&gt;100 &lt;/td&gt;
                      &lt;/tr&gt;
                      &lt;tr&gt;
                          &lt;td class='cost'&gt;86 &lt;/td&gt;
                      &lt;/tr&gt;
                      .
                      .
                      .
                      &lt;tr&gt;
                          &lt;td class='cost'&gt;56 &lt;/td&gt;
                      &lt;/tr&gt;           
                  &lt;/tbody&gt;
                  &lt;tfoot&gt;...&lt;/tfoot&gt;
              &lt;/table&gt;
  
              &lt;!--- Second table --&gt;
  
              &lt;table class="Feb"&gt;
                  &lt;thread&gt;...&lt;/thread&gt;
                  &lt;tbody&gt;
                      &lt;tr&gt;
                          &lt;td class='cost'&gt;-856 &lt;/td&gt;
                      &lt;/tr&gt;
                      &lt;tr&gt;
                          &lt;td class='cost'&gt;-8986 &lt;/td&gt;
                      &lt;/tr&gt;
                      .
                      .
                      .
                      &lt;tr&gt;
                          &lt;td class='cost'&gt;-9856 &lt;/td&gt;
                      &lt;/tr&gt;           
                  &lt;/tbody&gt;
                  &lt;tfoot&gt;...&lt;/tfoot&gt;
              &lt;/table&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p></p>