Comments (9)
I think I've found it!
You haven't specified the BrowserVersion
that your WebClient will emulate, so it defaults to the best-supported version - which is currently Chrome. And when your WebClient initialises its JavaScript support, the configuration class (com.gargoylesoftware.htmlunit.javascript.configuration.AbstractJavaScriptConfiguration
, if you're wondering) will trawl the annotations on all known JavaScript objects (the list is in com.gargoylesoftware.htmlunit.javascript.configuration.JavaScriptConfiguration
) to check whether they support the selected BrowserVersion
. And WebSocket
uses the JsxClass
annotation with default values - which support Chrome. So, by default, it will attempt to load WebSocket support.
So yes, you probably should add the websocket-client
dependency. I assume that it was dropped so that clients using a different browser version don't have to include it - although since the default is to rely on it, I'd call that a poor choice. If someone really doesn't want that JAR, they can specifically exclude it themselves.
from htmlunit-driver.
Adding dependency for websocket-client seems to work but is this intended to be so?
from htmlunit-driver.
Spring Boot is also affected by that issue. Has it been reported to the htmlunit team? Thanks!
from htmlunit-driver.
I believe HtmlUnit 2.23 already includes websocket-client by default.
Not sure why the dependency to HtmlUnit in HtmlUnitDriver should excludes it, is it because of conflict with other websocket-client versions? In this case, the new version should be added in HtmlUnitDriver pom.xml
from htmlunit-driver.
@asashour if I have a simple maven project with the following dependency
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>htmlunit-driver</artifactId>
<version>2.23</version>
<scope>test</scope>
</dependency>
I don't have websocket-client
. However if I add the following
<dependency>
<groupId>net.sourceforge.htmlunit</groupId>
<artifactId>htmlunit</artifactId>
<version>2.23</version>
<scope>test</scope>
</dependency>
I do have the websocket-client
so it looks like something in htmlunit-driver
excludes it...
from htmlunit-driver.
This was introduced in a0f6a29
from htmlunit-driver.
@asashour could we please have a bug fix release with that fix in the pom please? Spring Boot 1.5 is around the corner and we can't upgrade because of that. I am happy to provide a PR and test it if that speed up things. Let me know!
from htmlunit-driver.
Thanks for reporting, fixed in f403a5a.
I hope members who can release handle this.
Can you just add the dependency manually, when HtmlUnitDriver is referenced?
from htmlunit-driver.
Can you just add the dependency manually, when HtmlUnitDriver is referenced?
No, I don't use htmlunit but Spring Boot provides auto-configuration for the WebClient
. If a user of Spring Boot adds htmlunit on the classpath, we auto-configure the WebClient
and it will throw this exception unless websocket-client
is manually added. We won't upgrade until this issue is fixed as we cannot shield our users from this (they add the dependency themselves).
A bug fix release in the coming couple of weeks would be very appreciated.
from htmlunit-driver.
Related Issues (20)
- Driver not switching tabs and windows HOT 3
- NoSuchMethodError after quitting or closing driver and then re-calling it? HOT 6
- Angular support for htmlunitdriver ? HOT 1
- Breaking API changes in 4.8.1 HOT 9
- getDomProperty("value") does return "null" whereas getAttribute("value") returns a value HOT 9
- Selenium driver HOT 1
- Test HOT 1
- To ignore - Error during JavaScript execution HOT 3
- How to setting proxy authorization with username/passwd in ubuntu-server 18.04 env HOT 8
- org.htmlunit.ScriptException: SyntaxError: Empty JSON string HOT 9
- HtmlUnitDriver needs to provide WebDriverInfo and DriverService service providers for Selenium 4 Grid HOT 4
- Searching with RelativeLocator does not work HOT 3
- Threading problem when using multiple frames
- Implement HasAuthentication to be able to use authentication HOT 1
- elem.getAttribute("src") should return an empty string if no src attribute is present
- elem.getAttribute("xxx") should return null if no 'xxx' attribute is present
- XPath Not Working Via document.evaluate HOT 4
- Rhino not compiling any JavaScript when ScriptException encountered HOT 7
- Runasync causing deadlock?
- Fetching innerHTML HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from htmlunit-driver.