title: Scrape td attribute rows with selenium
body: <p>I am trying to scrape with selenium a table of products.</p>
  <p>Here is my example table:</p>
  <pre><code>&lt;div class=&quot;article&quot;&gt;
    &lt;table style=&quot;width: 100%&quot;&gt;
          &lt;tbody&gt;&lt;tr&gt;
            &lt;td class=&quot;trenner_u&quot;&gt;&lt;/td&gt;
            &lt;td class=&quot;trenner_u&quot;&gt;
              &lt;a href=&quot;/details/12900101&quot; class=&quot;changeable&quot;&gt;
                &lt;span&gt;Product 1 &lt;/span&gt;
              &lt;/a&gt;
            &lt;/td&gt;
            &lt;td class=&quot;trenner_lu&quot;&gt;
              11.11.1999
            &lt;/td&gt;
            &lt;td class=&quot;trenner_lu&quot;&gt;
              &lt;a title=&quot;Category Product Group&quot; href=&quot;/grp/detailsSmallTB_iframe=true&amp;amp;height=132&amp;amp;width=420&quot; class=&quot;thickbox&quot;&gt;Group 1&lt;/a&gt;
            &lt;/td&gt;
            &lt;td class=&quot;trenner_lu&quot;&gt;
  1999$
            &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
            &lt;td class=&quot;trenner_u&quot;&gt;&lt;/td&gt;
            &lt;td class=&quot;trenner_u&quot;&gt;
              &lt;a href=&quot;/details/12900347&quot; class=&quot;changeable&quot;&gt;
                &lt;span&gt;Product 2 &lt;/span&gt;
              &lt;/a&gt;
            &lt;/td&gt;
            &lt;td class=&quot;trenner_lu&quot;&gt;
              1.12.1944
            &lt;/td&gt;
            &lt;td class=&quot;trenner_lu&quot;&gt;
              &lt;a title=&quot;Category Product Group&quot; href=&quot;/grp/detailsSmallTB_iframe=true&amp;amp;height=132&amp;amp;width=420&quot; class=&quot;thickbox&quot;&gt;Group 2&lt;/a&gt;
            &lt;/td&gt;
            &lt;td class=&quot;trenner_lu&quot;&gt;
  1234$
            &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
            &lt;td class=&quot;trenner_u&quot;&gt;&lt;/td&gt;
            &lt;td class=&quot;trenner_u&quot;&gt;
              &lt;a href=&quot;/details/12908635&quot; class=&quot;changeable&quot;&gt;
                  &lt;img class=&quot;positionable&quot; src=&quot;/ImageImage/12908635&quot; alt=&quot;&quot; style=&quot;width: 100px; opacity: 0.9;&quot;&gt;  
                &lt;span&gt;Product 1 &lt;/span&gt;
    &lt;img src=&quot;/Content/images/icons/photo.png&quot; alt=&quot;Foto&quot;&gt;
              &lt;/a&gt;
            &lt;/td&gt;
            &lt;td class=&quot;trenner_lu&quot;&gt;
              05.12.1950
            &lt;/td&gt;
            &lt;td class=&quot;trenner_lu&quot;&gt;
                          &lt;a title=&quot;Category Product Group&quot; href=&quot;/grp/detailsSmallTB_iframe=true&amp;amp;height=132&amp;amp;width=420&quot; class=&quot;thickbox&quot;&gt;Group 2&lt;/a&gt;
  ,&lt;a title=&quot;Category Product Group&quot; href=&quot;/grp/detailsSmallTB_iframe=true&amp;amp;height=132&amp;amp;width=420&quot; class=&quot;thickbox&quot;&gt;Group 4&lt;/a&gt;
  
            &lt;/td&gt;
            &lt;td class=&quot;trenner_lu&quot;&gt;
  131282$
            &lt;/td&gt;
          &lt;/tr&gt;
          
    &lt;/tbody&gt;&lt;/table&gt;
  &lt;/div&gt;
  </code></pre>
  <p>I tried to scrape each element with:</p>
  <pre><code>    List&lt;WebElement&gt; links = driver.findElements(By.xpath(&quot;//*[@id=\&quot;home\&quot;]/div[3]/table/tbody/tr/td[2]/a&quot;));
      List&lt;WebElement&gt; prodNames = driver.findElements(By.xpath(&quot;//*[@id=\&quot;home\&quot;]/div[3]/table/tbody/tr/td[2]/a&quot;));
      List&lt;WebElement&gt; group = driver.findElements(By.xpath(&quot;//*[@id=\&quot;home\&quot;]/div[3]/table/tbody/tr/td[4]/a&quot;));
      
  </code></pre>
  <p>However, as you can see one of my <code>td</code> elements has two links inside, therefore my WebElement list has not the same length and it is extremely hard to merge together.</p>
  <p>My desired list output should look like that:</p>
  <pre><code>[Product 1, 11.11.1999, Group 1, 1999$], [Product 2, 1.12.1944,Group 2, 1234$], [Product 1, 05.12.1950, Group 2 Group 2, 131282$]
  </code></pre>
  <p>Any suggestion how to scrape such a table much more efficient?</p>
  <p>I appreciate your replies!</p>