NoSuchMethodError after quitting or closing driver and then re-calling it?
See original GitHub issueI am using the snapshot version of HtmlUnit and noticed that when I am closing or quitting all drivers and then re-initializing during the same application run I get a NoSuchMethodError.
Running with HtmlUnit 2.64, driver 3.62 and Selenium 4.2.2 works fine and each additional loop works fine.
This is odd, as the first cycle executes the code fine, but after closing and re-running I get this throwable.
Unfortunately I don’t have a test case for this one nor any code I can easily share and will test it after the next major version is released to see if it was related to the snapshot build only somehow, but wanted to let you know in case it is obvious for you what could have caused this.
java.lang.NoSuchMethodError: 'com.gargoylesoftware.htmlunit.javascript.host.css.CSS2Properties com.gargoylesoftware.htmlunit.javascript.host.Window.getComputedStyle(java.lang.Object, java.lang.String)' at org.openqa.selenium.htmlunit.HtmlUnitWebElement.getCssValue(HtmlUnitWebElement.java:585) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:568) at org.openqa.selenium.support.pagefactory.internal.LocatingElementHandler.invoke(LocatingElementHandler.java:52) at jdk.proxy2/jdk.proxy2.$Proxy31.getCssValue(Unknown Source) at org.openqa.selenium.support.ui.ExpectedConditions.getAttributeOrCssValue(ExpectedConditions.java:1184) at org.openqa.selenium.support.ui.ExpectedConditions.lambda$attributeToBeNotEmpty$0(ExpectedConditions.java:1178) at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:208)
Issue Analytics
- State:
- Created a year ago
- Comments:6
@skyhirider great - have fun using HtmlUnit.
@rbri I found the issue and it was my mistake.
I imported both htmlunit and the htmlunit-driver into a project, where the browser was 2.65.1 and the driver was 3.64.0
The driver tried to call the old method signature which it could no longer find as the browser on the classpath did not have it.
For any people finding this later, don’t be like me, check your maven dependency conflicts in Idea 😃
And don’t import both driver and browser, the driver is enough in your pom file.