I have one HTML string which I am opening in browser from PhanthomJs and trying to save the outcome URL.
My code looks as below.
driver.get("data:text/html;charset=utf-8,{html_content}".format(html_content=html_content))
element = driver.find_element_by_tag_name('body')
elem = element.find_element_by_tag_name('noscript')
print elem.find_element_by_tag_name('img')
The html_content look like below.
<script language="javascript" src="https://somejs"></script>
<noscript>
<a href="https://track.adform.net/C/?bn=15864640;C=0" target="_blank">
<img src="https://actualimage.net/verbserve/?bn=155679864640;srctype=4;ord=[timestamp]" border="0" width="728" height="90" alt=""/>
</a>
</noscript>
Above html render an image when I ran it locally as html file.
I wanted to save that image with the code I have mentioned above. But unfortunately I am not able to find the img using find_element_by_tag_name
I am getting below error.
selenium.common.exceptions.NoSuchElementException: Message: {"errorMessage":"Unable to find element with tag name 'img'","request"
Please let me know what might I am doing wrong here.