I'm scanning a website to check if a certain script exists on the site. I have been successful in extracting this information from most sites but there are a few which is causing trouble for me eg. 247sports.com, where I'm unable to get this information the DOM looks like this
...
<iframe src='...'>
<!DOCTYPE html>
<html lang..>
<head>
<iframe> ...</iframe>
...
<script id="utag_81" src="https://js.agkn.com/prod/v0/tag.js?_rnd=0.6281110988358267" type="text/javascript" charset="utf-8" async=""></script>
...
</iframe>
I'm using Firefox Webdriver to look for the "agkn" string in src="https://js.agkn.com/prod..."
Python code:
x = Webdriver.find_elements_by_xpath("(//iframe|//script|//img|//a)[contains(text(),'agkn') or contains(@src,'agkn') or contains(.,'agkn') or contains(@id,'utag_81') ]")
the length of x is always 0.
does the <!DOCTYPE html>
have something to do with this?.