title: How to extract the dynamic values of the id attributes of the table elements using Selenium and Java
body: <p>I have a table where each row will have a download link with a (partly) auto-generated id element. The reason for this is that the actual href-element will allways be "#", so the id's separate the downloads.</p>
  
  <p>I need to find the name of that id element in the td. That is: I know the table row has an id element, and I know part of the name, and I need to get the exact name.</p>
  
  <p>I'm accessing each row one at a time, so I only need to look within ONE td at a time. No need to look through the whole table.</p>
  
  <p>I know well how to find an element when I know the name. But to find the element when I only know the type is another thing.</p>
  
  <pre><code>...
  &lt;tr&gt;
   &lt;td class="journalTable-journalPost"
    &lt;a class="htext-small" href="#" id="downloadJournalPost-345"&gt;Download&lt;/a&gt;
   &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td class="journalTable-journalPost"
    &lt;a class="htext-small" href="#" id="downloadJournalPost-346"&gt;Download&lt;/a&gt;
   &lt;/td&gt;
  &lt;/tr&gt;
  ...
  </code></pre>
  
  <p>I cannot find any method(s) in the webdriver that lets me find an element by type.</p>
  
  <p>Partial name would work, since the id's get the name "downloadJournalPost-xxx", where only xxx changes. But link text is the only value I can find which lets me search for a partial match.</p>
  
  <p>EDIT: More complete markup.</p>
  
  <pre><code>&lt;td class="journalTable-journalpost"&gt;
   &lt;span class="hb-tekst--sekundar"&gt;In &lt;!----&gt;&lt;est-ikon class="ng-star-inserted"&gt;
    &lt;div aria-hidden="true" class="hb-ikon hb-ikon--pil3-inn  "&gt;
     &lt;svg focusable="false"&gt;
      &lt;use xlink:href="#ikon-pil3-inn"&gt;&lt;/use&gt;
     &lt;/svg&gt;
    &lt;/div&gt;&lt;/est-ikon&gt;&lt;!----&gt;&lt;/span&gt;
   &lt;span class="hb-tekst--mellomTittel hb-avstandIngen"&gt; Application and attachments&lt;/span&gt;
   &lt;a class="hb-tekst--liten" href="#" id="lastNedJournalPost-2892"&gt;Download journal post&lt;/a&gt;
  &lt;/td&gt;
  </code></pre>