Pretty new to Selenium. I have this javascript code snippet and I'm trying to use Selenium to inspect the script with no luck. All I want to do is use Selenium to access/inspect the script to verify that it is on my page.
Anonymous function:
<script type="text/javascript">
(function(a,b,c,d){
a='https://someurl.com:24800/somejs.js';
b=document;
c='script';
d=b.createElement(c);d.src=a;d.type='text/java'+c;
d.async=true;
a=b.getElementsByTagName(c)[0];
if (a.src !== d.src) {
a.parentNode.insertBefore(d,a);
}
})();
</script>
To make the problem more clear, in another scenario I have successfully been able to retrieve a snippet of javascript that is assigned to a variable name like this:
<script type="text/javascript">
var my_var = { attribute_1:'something', attribute_2:'somethingElse'}
</script>
Then in my Selenium test...
JavascriptExecutor jsEx = (JavascriptExecutor) driver;
Map<String, String> topScript = (Map<String, String>)jsEx.executeScript("return my_var");
This works fine and my topScript returns the script that I am able to parse. I want to do the same thing with the anonymous function above (if possible)
I've already tried these posts, no dice: