selenium: [๐ Bug]: Chrome 111 is not compatible with default HTTP Client
What happened?
After the Chrome 111 update, you can no longer kick off a chromedriver instance unless you add an additional chrome option:
โโremote-allow-origins=*โ
I submitted a bug with Google and they responded, and indicated this has to do with Selenium setting the origin header:
https://bugs.chromium.org/p/chromium/issues/detail?id=1422444
How can we reproduce the issue?
Just update to chrome 111, and try and run a UI selenium test.
I am using Java and Junit. See the link to the Chrome ticket for more details on how I was personally starting the driver.
Relevant log output
Mar 07, 2023 8:18:50 PM org.openqa.selenium.remote.http.WebSocket$Listener onError
WARNING: Invalid Status code=403 text=Forbidden
java.io.IOException: Invalid Status code=403 text=Forbidden
at org.asynchttpclient.netty.handler.WebSocketHandler.abort(WebSocketHandler.java:92)
at org.asynchttpclient.netty.handler.WebSocketHandler.handleRead(WebSocketHandler.java:118)
at org.asynchttpclient.netty.handler.AsyncHttpClientHandler.channelRead(AsyncHttpClientHandler.java:78)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:436)
at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:324)
at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:311)
at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:432)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:276)
at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:251)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:722)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:658)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:584)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:496)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.base/java.lang.Thread.run(Thread.java:833)
org.openqa.selenium.remote.http.ConnectionFailedException: Unable to establish websocket connection to http://localhost:64820/devtools/browser/27cc1ab2-7320-47bf-b503-1099b7052fcc
Build info: version: '4.4.0', revision: 'e5c75ed026a'
System info: host: 'sdg-mac334.local', ip: '2601:681:8004:57a0:0:0:0:5bfc%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '12.1', java.version: '17.0.4.1'
Driver info: driver.version: Driver
Operating System
Mac OS Monterey
Selenium version
4.4.0
What are the browser(s) and version(s) where you see this issue?
Chrome 111
What are the browser driver(s) and version(s) where you see this issue?
Iโm using webdriver manager, so whichever the latest one its grabbing.
Are you using Selenium Grid?
No response
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 18
- Comments: 60 (8 by maintainers)
Commits related to this issue
- fix: Make Chrome 111 work (#1611) Uses the new JDK 11 based HTTP client which does not have a problem with sending extra Origin-headers Related to https://github.com/SeleniumHQ/selenium/issues/11750 — committed to vaadin/testbench by Artur- a year ago
- [plugin-web-app] Add workaround for Chrome 111 Root cause is the changes in Chrome behavior: https://bugs.chromium.org/p/chromium/issues/detail?id=1422444 Discussion: https://groups.google.com/g/chro... — committed to vividus-framework/vividus by valfirst a year ago
- [plugin-web-app] Add workaround for Chrome 111 (#3708) Root cause is the changes in Chrome behavior: https://bugs.chromium.org/p/chromium/issues/detail?id=1422444 Discussion: https://groups.google.c... — committed to vividus-framework/vividus by valfirst a year ago
- Fix selenium issue https://github.com/SeleniumHQ/selenium/issues/11750 https://www.selenium.dev/blog/2022/using-java11-httpclient/ — committed to cloudfoundry/uaa by strehle a year ago
- Fix selenium issue (#2236) https://github.com/SeleniumHQ/selenium/issues/11750 https://www.selenium.dev/blog/2022/using-java11-httpclient/ — committed to cloudfoundry/uaa by strehle a year ago
- workaround for https://github.com/SeleniumHQ/selenium/issues/11750 — committed to bhecquet/seleniumRobot by bhecquet a year ago
- Add temporary workaround for https://github.com/SeleniumHQ/selenium/issues/11750 — committed to jrhillery/fwlookup by deleted user a year ago
- Fix selenium issue (#2236) https: //github.com/SeleniumHQ/selenium/issues/11750 https: //www.selenium.dev/blog/2022/using-java11-httpclient/ - cherry-picked from develop branch, as 74.5.x branch CI ... — committed to cloudfoundry/uaa by strehle a year ago
- [grid] Adding `remote-allow-origins` for Chrome stereotypes Also fixes #11750 — committed to SeleniumHQ/selenium by diemol a year ago
- Workaround for https://github.com/SeleniumHQ/selenium/issues/11750 and https://groups.google.com/g/chromedriver-users/c/xL5-13_qGaA — committed to TWiStErRob/net.twisterrob.healthcheck by TWiStErRob a year ago
- Adopt Selenium java 4.8.3, remove temporary workaround for https://github.com/SeleniumHQ/selenium/issues/11750 — committed to jrhillery/fwlookup by deleted user a year ago
- Adopt Selenium java 4.8.3, remove temporary workaround for https://github.com/SeleniumHQ/selenium/issues/11750 — committed to jrhillery/mdutil by deleted user a year ago
- apply Workaround to allow to use Chrome 111+ https://github.com/SeleniumHQ/selenium/issues/11750 — committed to abendt/FluentLenium by abendt a year ago
- apply Workaround to allow to use Chrome 111 + fix warnings/tests (#1832) apply Workaround to allow to use Chrome 111+ * https://github.com/SeleniumHQ/selenium/issues/11750 fix warnings/tests to ... — committed to FluentLenium/FluentLenium by abendt a year ago
- adding workaround for selenium httpclient issue (see notes) An updated version of the chromium webdriver fails due to some issue with the httpclient that selenium uses. The gist is that chromedrivee... — committed to digital-antiquity/tdar by jtdevos a year ago
- Upgrade Selenium WebDriver from 4.0.0 to 4.9.0. This fixes https://github.com/SeleniumHQ/selenium/issues/11750, which caused item screenshotting to fail when Google Chrome got upgraded past version 1... — committed to edmazur/everquest-robot-stanvern by edmazur a year ago
- Changes for 5.0.4 version Switch to Selenium 4 and JDK 11 Implement several improvements: - Log should display system property value used during scenario execution: Currently the log file displays ... — committed to IBM/spot-core by ffusier a year ago
- [๐ Bug]: Chrome 111 is not compatible with default HTTP Client #11750 See https://github.com/SeleniumHQ/selenium/issues/11750 — committed to gounthar/git-parameter-plugin by gounthar 9 months ago
- [๐ Bug]: Chrome 111 is not compatible with default HTTP Client #11750 See https://github.com/SeleniumHQ/selenium/issues/11750 — committed to gounthar/git-parameter-plugin by gounthar 9 months ago
- Remove workaround for SeleniumHQ/selenium#11750 — committed to LabKey/testAutomation by labkey-tchad 8 months ago
Adding
and
makes tests work again
For people searching for the fix; Here is the โOfficialโ answer:
and
ChromeOptionsinstance:This will be released in a couple of days. In the meantime, the workaround described above is still valid.
How can i add this new arg for the chrome options??
Is it something like this?
ChromeOptions options = new ChromeOptions(); options.addArguments(โโremote-allow-origins=*โ);
??
Thanks guys
The issue is in Java Selenium when using the Java 8 HTTP client. We are working on a fix as we speak and should be out with version 4.9.0 next week the latest. Titus comment above is on point and has all the information needed to go around this issue while the new version comes out.
Folks, please avoid spamming the issue, otherwise we might need to lock comments on it.
WebDriver driver = new ChromeDriver(options); // update this mentioned line
Ok, we could also add this to the Service class the same way we are doing for Firefox. That probably is the right thing to do if we continue to support Java < 11
@kmosakowska-clgx it worked for me with serenity <serenity.version>3.2.5</serenity.version>.
I think the issue might be related to https://github.com/netty/netty/issues/9673 which seems to be fixed in netty 5 (I believe Selenium is using netty 4 still)
reminder: Itโs fixed in the latest version of Selenium
rodriguesxd7 remove Webdriver from LoginPage super constructor. That should be easy to spot using an IDE (intellij, vscode, etc).
looks like itโs already added in 6.12.2 with PR-2194
The code below worked for me with Maven Project, but I could not use this same code in Java Project. So if you want to try this please go with this.
Configuration:
@derRichter Its still not working for me i am adding dependencies here which i am using.