Python Selenium get image name from website
<p>I am trying to scrape a website for my project, but i'm having trouble with scrapping image names via Selenium from this <a href="http://comparefirst.sg/wap/productsListEvent.action?prodGroup=whole&amp;pageAction=prodlisting" rel="nofollow">website</a></p>

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

<p>with the below code, I am able to use selenium to return me the <code>text</code> data from the website</p>

<pre><code>results = driver.find_elements_by_css_selector("li.result_content")

for result in results:
    company_name = result.find_element_by_tag_name("h3").get_attribute("innerText")
    product_name = result.find_element_by_id('sProdName').get_attribute("innerText")
    product_paymode = result.find_element_by_id('paymode').get_attribute("innerText")
</code></pre>

<p>I was told to use <code>get_attribute("innerText")</code> because there are several items hidden, and <code>get_attribute("innerText")</code> would help me get the hidden items. (True enough, it works)</p>

<p>my question is: How do I scrape the <code>prod-feature-icon</code> class, to tell me if that picture is <code>active</code> or not??</p>

<p>Why not use <a href="http://selenium-python.readthedocs.io/locating-elements.html" rel="nofollow">find_element_by_class_name</a> ?</p>

<pre><code>feature_icon = result.find_element_by_class_name("prod-feature-icon")
</code></pre>

<p>However it's worth noting that the object with this class name is actually a <code>UL</code> within it there are several images so you need to decide which image exactly you want to work with from that. Alternatively you could iterate through them with</p>

<pre><code>for item in feature_icon.find_elements_by_tag_name('img'):
    print(item.get_attribute('src'))
</code></pre>

<p>of course this wouldn't still tell you whether the item is active or inactive because that doesn't seem to be dictated by the CSS but rather by the shading of the image</p>

python selenium