HtmlUnit does not load javascript with links to external links

I am having a problem while trying to test a web application using HtmlUnit. Please keep in mind that I haven't used HtmlUnit for very long, so I might be missing something trivial.

For some reason javascripts with external link are not loading. When I print the page as xml, all I get is:

<script language="javascript" src="urltofile.js">  
</script>  

      

As you can see, the script tag is empty if it should contain javascript. What am I missing? I had a morning to solve the problem, but I didn't find any relevant information. Any help would be greatly appreciated!

+2


a source to share


2 answers


After many hours of surfing the internet, I found the solution to be very simple. All I had to do was wait a few seconds after the page was restored to let javascript execute for a while before doing anything else. I can honestly say that finding a solution was a bit frustrating, but at least I can get down to more important things now. :)



+3


a source


This tag loads an external file: "urltofile.js", so it's not weird to do nothing, because the js code is loaded from this file and not injected into the existing markup.



+1


a source







All Articles