Exception when using Select element

16 views
Skip to first unread message

Thomas Hirsch

unread,
Feb 25, 2021, 10:28:06 AM2/25/21
to Geb User Mailing List
Hi, 
sometimes a test of mine fails with this stacktrace:

```
    java.lang.NoClassDefFoundError: Could not initialize class org.openqa.selenium.NotFoundException
        at org.openqa.selenium.support.ui.Select.findOptionsByValue(Select.java:287)
        at org.openqa.selenium.support.ui.Select.selectByValue(Select.java:190)
        at geb.navigator.DefaultNavigator.setSelectValue(DefaultNavigator.groovy:988)
        at geb.navigator.DefaultNavigator.setInputValue(DefaultNavigator.groovy:931)
        at geb.navigator.DefaultNavigator.setInputValues_closure56(DefaultNavigator.groovy:922)
        at groovy.lang.Closure.call(Closure.java:412)
        at geb.navigator.DefaultNavigator.setInputValues(DefaultNavigator.groovy:921)
        at geb.navigator.DefaultNavigator.value(DefaultNavigator.groovy:652)
        at geb.content.TemplateDerivedPageContent.value(TemplateDerivedPageContent.groovy:34)
        at geb.content.PageContentSupport.propertyMissing(PageContentSupport.groovy:54)
        at geb.Page.propertyMissing(Page.groovy:110)
        at geb.Browser.propertyMissing(Browser.groovy:239)
        at geb.spock.GebSpec.propertyMissing(GebSpec.groovy:1)
        at ...
```
The line in the spec is using the assignment operator, i.e. `myElement = myValue` where `myElement` is a Geb navigator pointing to a HTML-Select element.

Regardless of what the test does, I would like to understand how this Exception can even happen. The class is present in my library list, it is part of the selenium-api package, which (I assume) Geb depends on.

Thomas

Marcin Erdmann

unread,
Feb 26, 2021, 10:39:56 AM2/26/21
to geb-...@googlegroups.com
Thomas,

I agree that it's surprising that you are getting this exception as org.openqa.selenium.NotFoundException is indeed part of selenium-api artifact. On thing that surprises me further is that I don't see org.openqa.selenium.NotFoundException being used in Select.findOptionsByValue(), at least not in 3.141.59. What is the version of selenium-support and selenium-api artifacts that you have on the classpath?

Cheers,
Marcin

--
You received this message because you are subscribed to the Google Groups "Geb User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geb-user+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/geb-user/ecd08d16-afcf-495e-93a3-c2a23b9b25een%40googlegroups.com.

Thomas Hirsch

unread,
Feb 26, 2021, 11:48:19 AM2/26/21
to Geb User Mailing List
Hi Marcin, 

currently I am using these versions:
  • Gradle: org.seleniumhq.selenium:selenium-http:4.0.0-alpha-7
  • Gradle: org.seleniumhq.selenium:selenium-devtools:4.0.0-alpha-7
  • Gradle: org.seleniumhq.selenium:selenium-json:4.0.0-alpha-7
  • Gradle: org.seleniumhq.selenium:selenium-chromium-driver:4.0.0-alpha-7
  • Gradle: org.seleniumhq.selenium:selenium-chrome-driver:4.0.0-alpha-7
  • Gradle: org.seleniumhq.selenium:selenium-api:4.0.0-alpha-7
  • Gradle: org.seleniumhq.selenium:selenium-remote-driver:4.0.0-alpha-7
  • Gradle: org.seleniumhq.selenium:selenium-support:4.0.0-alpha-7
There is another similar error, that I encountered, I will also put the stack trace here.
Is is another error, this time it is not related to operation of a Select element, instead it occurs as a result of a StaleElementReferenceException.

Again, the problem is not what the test does, but what kind of exception it produces.
I have the impression this only occurs on my local machine (Chrome/MacOS), and not when running against the Docker-Selenium-Grid, but this is hard to confirm.

The NoClassDefFoundError is just really puzzling...
It's not a blocker for me, but I just wanted to show you this, just in case.

I can understand what it's telling me, that the test is unstable, either the Select is not fully loaded on the page yet, and in the other case below, a StaleElementReferenceException occurs, both of these things are very plausible, in fact I am exactly trying to work around those respective problems in those places.
I have seen this in the past, and I thought it might be a result of incompatible library versions, so I didn't bother about it right way, assuming it might go away after some updates.
But even after several chromedriver and Selenium upgrades, the error still seems to happen.

The other stacktrace:
```
condition did not pass in 30 seconds (failed with exception)
geb.waiting.WaitTimeoutException: condition did not pass in 30 seconds (failed with exception)
at geb.waiting.Wait.waitFor(Wait.groovy:124)
at geb.waiting.DefaultWaitingSupport.doWaitFor(DefaultWaitingSupport.groovy:50)
at geb.waiting.DefaultWaitingSupport.waitFor(DefaultWaitingSupport.groovy:37)
at geb.Module.waitFor(Module.groovy:124)
at <myModule.myMethod>
at geb.content.TemplateDerivedPageContent.methodMissing(TemplateDerivedPageContent.groovy:98)
at spec.now.ui.PacklinkSpec.disconnect_and_delete_Packlink_shipping_method_if_configured_closure7(PacklinkSpec.groovy:330)
at groovy.lang.Closure.call(Closure.java:412)
at groovy.lang.Closure.call(Closure.java:428)
at <mySpec.myMethod>
at <mySpec.myOtherMethod>
Caused by: java.lang.NoClassDefFoundError: org.openqa.selenium.StaleElementReferenceException (initialization failure)
at java.base/java.lang.J9VMInternals.initializationAlreadyFailed(J9VMInternals.java:136)
at org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:196)
at org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:129)
at org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:53)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:167)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:123)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:501)
at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:238)
at org.openqa.selenium.remote.RemoteWebElement.findElements(RemoteWebElement.java:222)
at org.openqa.selenium.By$ByCssSelector.findElements(By.java:482)
at org.openqa.selenium.remote.RemoteWebElement.findElements(RemoteWebElement.java:188)
at geb.navigator.SearchContextBasedBasicLocator.elementsSupplier_closure8$_closure12(SearchContextBasedBasicLocator.groovy:199)
at groovy.lang.Closure.call(Closure.java:412)
at groovy.lang.Closure.call(Closure.java:428)
at geb.navigator.SearchContextBasedBasicLocator.elementsSupplier_closure8(SearchContextBasedBasicLocator.groovy:199)
at groovy.lang.Closure.call(Closure.java:412)
at geb.navigator.SearchContextBasedBasicLocator.toNavigator(SearchContextBasedBasicLocator.groovy:223)
at geb.navigator.SearchContextBasedBasicLocator.find(SearchContextBasedBasicLocator.groovy:186)
at geb.navigator.SearchContextBasedBasicLocator.find(SearchContextBasedBasicLocator.groovy:55)
at geb.navigator.DefaultLocator.find(DefaultLocator.groovy:22)
at geb.navigator.DefaultLocator.find(DefaultLocator.groovy:31)
at geb.navigator.DefaultNavigator.find(DefaultNavigator.groovy:57)
at geb.content.NavigableSupport.$(NavigableSupport.groovy:65)
at geb.content.PageContentTemplateFactoryDelegate.$(PageContentTemplateFactoryDelegate.groovy:27)
at <myModule.myMethodClosure>
at <myModule.myMethodClosure>
at geb.content.PageContentTemplate.invokeFactory(PageContentTemplate.groovy:102)
at geb.content.PageContentTemplate.create_closure1(PageContentTemplate.groovy:59)
at geb.content.PageContentTemplate.create_closure1(PageContentTemplate.groovy)
at geb.content.PageContentTemplate.create(PageContentTemplate.groovy:87)
at geb.content.PageContentTemplate.get(PageContentTemplate.groovy:54)
at geb.content.DefaultPageContentSupport.getContent(DefaultPageContentSupport.groovy:42)
at geb.content.PageContentSupport.propertyMissing(PageContentSupport.groovy:41)
at geb.Module.propertyMissing(Module.groovy:106)
at groovy.lang.Closure.getPropertyTryThese(Closure.java:320)
at groovy.lang.Closure.getPropertyOwnerFirst(Closure.java:314)
at groovy.lang.Closure.getProperty(Closure.java:304)
at <myModule.myMethodClosure>
at <myModule.myMethodClosure>
at geb.waiting.Wait.waitFor(Wait.groovy:113)
... 10 more
Caused by: java.lang.NoClassDefFoundError: org.openqa.selenium.WebDriverException (initialization failure)
... 50 more
Caused by: java.lang.RuntimeException: java.lang.InterruptedException
at org.openqa.selenium.net.HostIdentifier.<clinit>(HostIdentifier.java:59)
at org.openqa.selenium.WebDriverException.<clinit>(WebDriverException.java:33)
at org.openqa.selenium.os.CommandLine.waitFor(CommandLine.java:130)
at org.openqa.selenium.remote.service.DriverService.lambda$start$1(DriverService.java:198)
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1700)
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1692)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
Caused by: java.lang.InterruptedException
at java.base/java.util.concurrent.TimeUnit.timedWait(TimeUnit.java:408)
at java.base/java.lang.ProcessImpl.waitFor(ProcessImpl.java:510)
at org.openqa.selenium.net.HostIdentifier.<clinit>(HostIdentifier.java:46)
... 10 more
```

Cheers, 
Thomas

Marcin Erdmann

unread,
Feb 27, 2021, 6:32:52 AM2/27/21
to geb-...@googlegroups.com
Thomas,

You seem to be living on the bleeding edge using these alpha releases... What is the reason for using Selenium 4 in your case? Does downgrading to the latest version in the 3.x line fix the issues?

Marcin

Reply all
Reply to author
Forward
0 new messages