I need to capture a list of element: "TEXT TO CAPTURE 1", "TEXT TO CAPTURE 2", ... scraping a web page with selenium and python. The HTML of the page is the following:
<div class="contenedor" style="overflow:auto; padding: 6px;">
<div style="width: 75px;">
<p class="line1">
<a href="http://www.somelink1.com/"><img src="https://www.somelink2.com" class="yborder" alt="Name"></a>
</p>
<p class="line1" style="align: center;">
<a href="www.somelink3.com" class="gensmall">TEXT TO CAPTURE 1</a>
</p>
</div>
<div style="width: 75px;">
<p class="line1">
<a href="www.somelink4.com"><img src="hwww.somelink5.com" class="yborder" alt="Dana Vespoli"></a>
</p>
<p class="line1" style="align: center;">
<a href="www.somelink6.com" class="gensmall">TEXT TO CAPTURE 2</a>
</p>
</div>
... others numbers of same <div> fields ....
</div>
The number of element are change day by day I open the page so the number of the elements are undefined.
I can get only the first element with this:
driver.find_element_by_xpath("//p[contains(@class, 'line1')]/following::a")
Thanks for help