1

After upgrading a complex site to Angular 14 (from previous version), an error that I've never seen before has started popping up seemingligly at random when the Selenium/Cucumber/Java test suite is run in Tekton. The error is not reproducible locally.

org.openqa.selenium.JavascriptException: javascript error: document unloaded while waiting for  result

I've not found anything about this error in Selenium, only a few cases with general page functionality and JavaScript.

Has anyone seen this before? I can't see that it has to do with Wait()-problems, since Selenium doesn't report anything about not finding elements. It doesn't report anything about page elements at all, just "document unloaded".

There are no screenshots produced by Cucumber either, and it doesn't mark the last step as failed. There's just the error after the step.

The complete error:

org.openqa.selenium.JavascriptException: javascript error: document unloaded while waiting for result
(Session info: chrome=105.0.5195.52)
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'sak-tjt-4927-oppgrader-star-20230509-105719-e2e-run-pod', ip: '10.128.9.195', os.name: 'Linux', os.arch: 'amd64', os.version: '4.18.0-372.52.1.el8_6.x86_64', java.version: '11.0.13'
Driver info: org.openqa.selenium.remote.RemoteWebDriver
Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 105.0.5195.52, chrome: {chromedriverVersion: 105.0.5195.19 (b9c217c128c1..., userDataDir: /tmp/.com.google.Chrome.sx4Zaj}, goog:chromeOptions: {debuggerAddress: localhost:33141}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: LINUX, platformName: LINUX, proxy: Proxy(), se:cdp: ws://10.129.12.14:4444/sess..., se:cdpVersion: 105.0.5195.52, se:vnc: ws://10.129.12.14:4444/sess..., se:vncEnabled: true, se:vncLocalAddress: ws://10.129.12.14:7900, setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:extension:credBlob: true, webauthn:extension:largeBlob: true, webauthn:virtualAuthenticators: true}
Session ID: 6ac5e2775265c90d61ef4963f6e30631 
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
at org.openqa.selenium.remote.RemoteWebDriver.executeAsyncScript(RemoteWebDriver.java:506)
at no.husbanken.e2e.rammeverk.selenium.driver.ExtendedWebDriver.isPageReady(ExtendedWebDriver.java:38)
at e2e.support.Hooks.afterEachScenario(Hooks.java:145)
at e2e.support.Hooks.tearDown(Hooks.java:120)
at jdk.internal.reflect.GeneratedMethodAccessor73.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at cucumber.runtime.Utils$1.call(Utils.java:26)
at cucumber.runtime.Timeout.timeout(Timeout.java:16)
at cucumber.runtime.Utils.invoke(Utils.java:20)
at cucumber.runtime.java.JavaHookDefinition.execute(JavaHookDefinition.java:65)
at cucumber.runner.HookDefinitionMatch.runStep(HookDefinitionMatch.java:16)
at cucumber.runner.TestStep.executeStep(TestStep.java:65)
at cucumber.runner.TestStep.run(TestStep.java:50)
at cucumber.runner.TestCase.run(TestCase.java:50)
at cucumber.runner.Runner.runPickle(Runner.java:50)
at io.cucumber.junit.PickleRunners$NoStepDescriptions.run(PickleRunners.java:146)
at io.cucumber.junit.FeatureRunner.runChild(FeatureRunner.java:68)
at io.cucumber.junit.FeatureRunner.runChild(FeatureRunner.java:23)
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at io.cucumber.junit.Cucumber.runChild(Cucumber.java:142)
at io.cucumber.junit.Cucumber.runChild(Cucumber.java:65)
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
at io.cucumber.junit.Cucumber$RunCucumber.evaluate(Cucumber.java:172)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:365)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:273)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:238)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:159)
at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:384)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:345)
at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:126)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:418)
  • Do you use some implicit wait? – pburgr May 09 '23 at 12:56
  • Nope. Most of the time there aren't any other sorts of Waits either. – kakemonsteret May 09 '23 at 14:20
  • Then use implicit wait. Selenium has to simulate real user and real user has to wait to embeded resources as well. Using implicit wait is pretty much standard / best practice. I usually set it to 10 seconds but some webs (better say environments) can require more depending on it's availability and latency. Run a simple test in JMeter with enabled option 'download embeded resources' to see potential bottlenecks. – pburgr May 10 '23 at 05:02

0 Answers0