iterate through classes in selenium python
<p>** Im running this on a popup page. therefore cant simply use "entry" class as it clashes with the original page.</p>

<p>I want to iterate through classes to pick out the text, from the "entry" class</p>

<pre><code>from selenium import webdriver
driver=webdriver.Firefox()
</code></pre>

<p><a href="https://i.stack.imgur.com/Llbhu.png" rel="nofollow"><img src="https://i.stack.imgur.com/Llbhu.png" alt="enter image description here"></a></p>

<p>When I pick the xpath of this elemnt from chrome , its coming like this</p>

<p>But this isnt working with <code>driver.find_element_by_xpath(/html/body/span/div[1]/div/div[3])</code></p>

<p>But below one is working, but its giving me date, heading etc. But I just want the text</p>

<pre><code>driver.find_element_by_class_name("ui_overlay").text 
</code></pre>

<p>Consider using this:</p>

<pre><code>for div in driver.find_elements_by_class_name("entry"):
    do_something(div.text)
</code></pre>

<p>After edited question:
This then must be solved using xpath.</p>

<pre><code>for div in driver.find_elements_by_xpath("//span/div/div/div[@class='entry']"):
    do_something(div)
</code></pre>

<p>If You provide webpage You're using, I can use even more precise xpath.</p>

python selenium web-scraping