fhoeben/hsac-fitnesse-fixtures

org.openqa.selenium.InvalidArgumentException: invalid argument: uniqueContextId not found

KvdE1994 opened this issue · 10 comments

Good afternoon,

Since chromedriver version 109.0.5414.74, I have been receiving the following error message:

org.openqa.selenium.InvalidArgumentException: invalid argument: uniqueContextId not found (Session info: headless chrome=109.0.5414.120) Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03' System info: host: 'XXXX', ip: 'XXX', os.name: 'Windows Server 2016', os.arch: 'amd64', os.version: '10.0', java.version: '11.0.17' Driver info: org.openqa.selenium.chrome.ChromeDriver Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 109.0.5414.120, chrome: {chromedriverVersion: 109.0.5414.74 (e7c5703604da..., userDataDir: C:\Program Files (x86)\scop...}, goog:chromeOptions: {debuggerAddress: localhost:64284}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: WINDOWS, platformName: WINDOWS, proxy: Proxy(), setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: ignore, webauthn:extension:credBlob: true, webauthn:extension:largeBlob: true, webauthn:virtualAuthenticators: true} Session ID: 1f663bb484089f8d2eb0fdfd0d9d26ab *** Element info: {Using=xpath, value=//button[.='Bevestigen' and not(contains(@class, 'invisible'))]} 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.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552) at org.openqa.selenium.remote.RemoteWebDriver.findElements(RemoteWebDriver.java:353) at org.openqa.selenium.remote.RemoteWebDriver.findElementsByXPath(RemoteWebDriver.java:432) at org.openqa.selenium.By$ByXPath.findElements(By.java:348) at nl.hsac.fitnesse.fixture.util.selenium.by.LazyPatternBy.findElements(LazyPatternBy.java:33) at org.openqa.selenium.remote.RemoteWebDriver.findElements(RemoteWebDriver.java:311) at nl.hsac.fitnesse.fixture.util.selenium.SeleniumHelper.lambda$findElements$3(SeleniumHelper.java:836) at nl.hsac.fitnesse.fixture.util.selenium.SeleniumHelper.doInCurrentContext(SeleniumHelper.java:869) at nl.hsac.fitnesse.fixture.util.selenium.SeleniumHelper.findElements(SeleniumHelper.java:836) at nl.hsac.fitnesse.fixture.slim.data.selectorsreader.YamlSelectors.lambda$getSelectorData$1(YamlSelectors.java:134) at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:176) at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177) at java.base/java.util.ArrayList$ArrayListSpliterator.tryAdvance(ArrayList.java:1632) at java.base/java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:127) at java.base/java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:502) at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:488) at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) at java.base/java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:150) at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.base/java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:543) at nl.hsac.fitnesse.fixture.slim.data.selectorsreader.YamlSelectors.getSelectorData(YamlSelectors.java:142) at nl.hsac.fitnesse.fixture.slim.data.selectorsreader.YamlSelectors.getElementFromSelectorsFile(YamlSelectors.java:97) at nl.hsac.fitnesse.fixture.slim.data.selectorsreader.YamlSelectors.getElementFromSelectorsFile(YamlSelectors.java:89) at nl.hsac.fitnesse.fixture.slim.web.UniveBrowserTest.getElementToClick(UniveBrowserTest.java:120) at nl.hsac.fitnesse.fixture.slim.web.BrowserTest.lambda$getElementToClick$9(BrowserTest.java:994) at nl.hsac.fitnesse.fixture.slim.web.BrowserTest.doInContainer(BrowserTest.java:1011) at nl.hsac.fitnesse.fixture.slim.web.BrowserTest.getElementToClick(BrowserTest.java:994) at nl.hsac.fitnesse.fixture.slim.web.BrowserTest.clickImp(BrowserTest.java:830) at nl.hsac.fitnesse.fixture.slim.web.BrowserTest.click(BrowserTest.java:754) at jdk.internal.reflect.GeneratedMethodAccessor7.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 fitnesse.slim.fixtureInteraction.SimpleInteraction.methodInvoke(SimpleInteraction.java:322) at nl.hsac.fitnesse.fixture.slim.SlimFixture.invoke(SlimFixture.java:65) at nl.hsac.fitnesse.fixture.slim.web.BrowserTest.superInvoke(BrowserTest.java:149) at nl.hsac.fitnesse.fixture.slim.web.BrowserTest.lambda$invokedWrappedInWaitUntil$0(BrowserTest.java:115) at nl.hsac.fitnesse.fixture.util.selenium.TryAllFramesConditionDecorator.lambda$apply$1(TryAllFramesConditionDecorator.java:27) at nl.hsac.fitnesse.fixture.util.selenium.AllFramesDecorator.invokeInFrames(AllFramesDecorator.java:64) at nl.hsac.fitnesse.fixture.util.selenium.AllFramesDecorator.apply(AllFramesDecorator.java:49) at nl.hsac.fitnesse.fixture.util.selenium.TryAllFramesConditionDecorator.apply(TryAllFramesConditionDecorator.java:27) at nl.hsac.fitnesse.fixture.util.selenium.TryAllFramesConditionDecorator.apply(TryAllFramesConditionDecorator.java:11) at nl.hsac.fitnesse.fixture.util.selenium.SeleniumHelper.lambda$getConditionIgnoringStaleElement$4(SeleniumHelper.java:1053) at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:249) at nl.hsac.fitnesse.fixture.util.selenium.SeleniumHelper.waitUntil(SeleniumHelper.java:1040) at nl.hsac.fitnesse.fixture.slim.web.BrowserTest.waitUntilImpl(BrowserTest.java:2252) at nl.hsac.fitnesse.fixture.slim.web.BrowserTest.waitUntil(BrowserTest.java:2182) at nl.hsac.fitnesse.fixture.slim.web.BrowserTest.invokedWrappedInWaitUntil(BrowserTest.java:142) at nl.hsac.fitnesse.fixture.slim.web.BrowserTest.invoke(BrowserTest.java:98) at nl.hsac.fitnesse.fixture.slim.SlimFixture.aroundSlimInvoke(SlimFixture.java:45) at jdk.internal.reflect.GeneratedMethodAccessor1.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 fitnesse.slim.fixtureInteraction.SimpleInteraction.methodInvoke(SimpleInteraction.java:322) at fitnesse.slim.fixtureInteraction.SimpleInteraction.callMethod(SimpleInteraction.java:305) at fitnesse.slim.fixtureInteraction.SimpleInteraction.invokeMethod(SimpleInteraction.java:290) at fitnesse.slim.fixtureInteraction.SimpleInteraction.findAndInvoke(SimpleInteraction.java:217) at fitnesse.slim.MethodExecutor.findAndInvoke(MethodExecutor.java:18) at fitnesse.slim.FixtureMethodExecutor.execute(FixtureMethodExecutor.java:18) at fitnesse.slim.StatementExecutor.getMethodExecutionResult(StatementExecutor.java:139) at fitnesse.slim.StatementExecutor.call(StatementExecutor.java:112) at fitnesse.slim.instructions.CallAndOptionalAssignInstruction.executeInternal(CallAndOptionalAssignInstruction.java:30) at fitnesse.slim.instructions.Instruction.execute(Instruction.java:29) at fitnesse.slim.ListExecutor$Executive.executeStatement(ListExecutor.java:49) at fitnesse.slim.ListExecutor$Executive.executeStatements(ListExecutor.java:43) at fitnesse.slim.ListExecutor.execute(ListExecutor.java:85) at fitnesse.slim.SlimServer.executeInstructions(SlimServer.java:82) at fitnesse.slim.SlimServer.processOneSetOfInstructions(SlimServer.java:75) at fitnesse.slim.SlimServer.tryProcessInstructions(SlimServer.java:62) at fitnesse.slim.SlimServer.serve(SlimServer.java:47) at fitnesse.testsystems.slim.InProcessSlimClient$1.run(InProcessSlimClient.java:55) at java.base/java.lang.Thread.run(Thread.java:829)

The xpath is being found and the action is being executed, yet the script stops at this point.
Where does this error come from and how can I fix it?
I have tried upgrading my hsac fitnesse selenium, but unfortunately, it has not yielded the desired result so far.
My project works on the following versions:

` <fitnesse.version>20210606</fitnesse.version>
<hsac.fixtures.version>6bfc71105b</hsac.fixtures.version>
->

com.github.Fruffel
hsac-fitnesse-fixtures
${hsac.fixtures.version}

`

I have no clue what this error could be, sorry. It looks like the fixtures are trying to find an element to click and then hits this error. You state the element is found and 'the action' is executed. What do you mean by that exactly?

It looks like you are running with an older version of FitNesse and the version number you have for the fixtures does not mean anything to me.
Have you tried with the latest released versions?

Encountering the exact same issue, using the following dependencies:

<fitnesse.version>20221219</fitnesse.version>
<hsac.fixtures.version>5.2.30</hsac.fixtures.version>
<hsac-fitnesse-plugin.version>1.32.10</hsac-fitnesse-plugin.version>

Working fine with Chrome 108.0.5359.71, issues with 109.0.5414.74 and 110.0.5481.77.

Error occurs on different tests at different instructions each run, but always seems to have nl.hsac.fitnesse.fixture.util.selenium.by.LazyPatternBy#findElements somewhere in the stack trace.

The error also occurs in version 110.5481.77. I have tried multiple new versions, but unfortunately without the desired result. Just like @DLeijenKeylane, this happens in several other tests.

In some cases, the screenshot shows that the xpath has been executed. However, the script is still being terminated with the above-mentioned error message.

suuuz commented

For me, a workaround has been to set the search context more specific.

Maybe this is a related issue? https://stackoverflow.com/questions/73979624/chrome-webdriver-version-106-goes-into-exception-uniquecontextid-not-found

When you run into this problem can you elaborate on what is happening on the page, what the page is?
Are multiple frames present, did you set a search context, is the page being reloaded, ....?

Anything that could point to a direction where the problem is coming from.

@KvdE1994 or @DLeijenKeylane
I tried creating a branch context_not_unique where the message invalid argument: uniqueContextId not found is added as on of the options in SeleniumHelper.isStaleElementException(). I wonder whether that would address the issue (or at least hide the error allowing the test to continue).

Since I have no environment reproducing the issue I cannot test it myself...
But maybe you can take the generated .jar from the target artifact of the build of that branch and see whether it alleviates the issue.

Disregard my previous comment (edited out). We'll try it out.

I actually made a release 5.2.31-beta that should include the change (and Selenium 4.8.1)

@fhoeben the beta release fixed the issue for us!

@fhoeben We also conducted various tests today. It seems that the beta version solves the problem!