question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NoSuchMethodError after quitting or closing driver and then re-calling it?

See original GitHub issue

I 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)

https://github.com/SeleniumHQ/htmlunit-driver/blob/c7dc458f43ddef8a553f0301eb008e7b509fe38d/src/main/java/org/openqa/selenium/htmlunit/HtmlUnitWebElement.java#L585

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
rbricommented, Nov 1, 2022

@skyhirider great - have fun using HtmlUnit.

0reactions
skyhiridercommented, Oct 31, 2022

@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.

image

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Fix java.lang.NoSuchMethodError in Java - Rollbar
NoSuchMethodError is a runtime error in Java which occurs when a method is called that exists at compile-time, but does not exist at...
Read more >
How do I fix a NoSuchMethodError? - java - Stack Overflow
To solve it I checked, firstly, Module Dependency Diagram ( click in your POM the combination -> Ctrl+Alt+Shift+U or right click in your...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found