I have a google search result, something like
div class="rc"
h3 class="r"
<a href="somelink">
<img id="idFOO" src="data:somethingFOO" style="...">
</a>
I want to add somethingFOO (or data:somethingFOO) to a string using python & selenium. How can I do that?
what you are interested is not a text, it's an attribute with name src. so if you will do something like that, you won't get what you want.
find_element_by_id("idFOO").text
if your html is like this,
<input id="demo">hello world </input>
then the following code will give you hello world
driver.find_element_by_id("demo").text
and following code will give you demo
driver.find_element_by_id("demo").get_attribute("id")
so in your case, it should be
driver.find_element_by_id("idFOO").get_attribute("src")