I'm trying to write some automated tests of a website using HtmlUnit. Our web pages load two JavaScripts, one of which then loads several other JavaScripts dynamically into the DOM. These JavaScripts then do some UI initialization. My problem is that HtmlUnit updates the DOM with the new JavaScripts, but does not then seem to run those JavaScripts, because expected DOM elements do not appear.
Here are some things I tried:
toXml()
. The page.toXml() method shows the JavaScripts added, but not the expected UI elements.
executeJavaScript
. When I do this, it can find the method I'm invoking directly, but that method cannot find symbols in other JavaScripts.
Has anyone else ran into this issue?
Did you try to insert a short pause after loading the page?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With