Giter Site home page Giter Site logo

Comments (9)

ThrawnCA avatar ThrawnCA commented on July 30, 2024 5

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.

andidev avatar andidev commented on July 30, 2024

Adding dependency for websocket-client seems to work but is this intended to be so?

from htmlunit-driver.

snicoll avatar snicoll commented on July 30, 2024

Spring Boot is also affected by that issue. Has it been reported to the htmlunit team? Thanks!

from htmlunit-driver.

asashour avatar asashour commented on July 30, 2024

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.

snicoll avatar snicoll commented on July 30, 2024

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

snicoll avatar snicoll commented on July 30, 2024

This was introduced in a0f6a29

from htmlunit-driver.

snicoll avatar snicoll commented on July 30, 2024

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

asashour avatar asashour commented on July 30, 2024

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.

snicoll avatar snicoll commented on July 30, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.