The purpose of webdriver.http.factory

498 views
Skip to first unread message

Hagay Hazan

unread,
Apr 30, 2023, 11:05:36 PM4/30/23
to Selenium Users

I found out that I am unable to run the following simple code example  
I had to add the following line

System.setProperty("webdriver.http.factory", "jdk-http-client");



Do you have any idea what the reason for this is?

package test;


import java.time.Duration;


import org.openqa.selenium.WebDriver;

import org.openqa.selenium.chrome.ChromeDriver;


import io.github.bonigarcia.wdm.WebDriverManager;


public class Browser {

public static void main(String[] args) {

System.setProperty("webdriver.http.factory", "jdk-http-client");

WebDriverManager.chromedriver().setup();

WebDriver driver = new ChromeDriver();

driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(10));

driver.manage().timeouts().scriptTimeout(Duration.ofMinutes(2));

driver.manage().timeouts().pageLoadTimeout(Duration.ofSeconds(10));

driver.get("https://google.com");

driver.navigate().to("https://automationstepbystep.com");

System.out.println(driver.getCurrentUrl());

System.out.println(driver.getTitle());

driver.close();

}


}


image.png

Andrei Solntsev

unread,
May 1, 2023, 1:04:30 AM5/1/23
to seleniu...@googlegroups.com
Hi Hagay!
Your chances to get help are much higher if you what means "I am unable to run". Are you getting some error? Then show the error. Show the stacktrace.

Andrei Solntsev


пн, 1 мая 2023 г. в 06:05, Hagay Hazan <hha...@gmail.com>:
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/b24a83de-3a95-4caf-a743-a3333c190eb4n%40googlegroups.com.

Hagay Hazan

unread,
May 2, 2023, 9:59:46 AM5/2/23
to Selenium Users


SLF4J: No SLF4J providers were found.

SLF4J: Defaulting to no-operation (NOP) logger implementation

SLF4J: See https://www.slf4j.org/codes.html#noProviders for further details.

Starting ChromeDriver 112.0.5615.49 (bd2a7bcb881c11e8cfe3078709382934e3916914-refs/branch-heads/5615@{#936}) on port 65125

Only local connections are allowed.

Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.

ChromeDriver was started successfully.

May 02, 2023 6:59:03 AM 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:444)

at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)

at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)

at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:436)

at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:346)

at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:333)

at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:454)

at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:290)

at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:251)

at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)

at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)

at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)

at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)

at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440)

at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)

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:788)

at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724)

at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650)

at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562)

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)


Exception in thread "main" org.openqa.selenium.remote.http.ConnectionFailedException: Unable to establish websocket connection to http://localhost:61732/devtools/browser/38ec0740-f02e-4f3e-81e1-db85fc5e3c65

Build info: version: '4.0.0', revision: '3a21814679'

System info: host: 'BDNA000627', ip: '192.168.0.3', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '17.0.6'

Driver info: driver.version: ChromeDriver

at org.openqa.selenium.remote.http.netty.NettyWebSocket.<init>(NettyWebSocket.java:102)

at org.openqa.selenium.remote.http.netty.NettyWebSocket.lambda$create$3(NettyWebSocket.java:128)

at org.openqa.selenium.remote.http.netty.NettyClient.openSocket(NettyClient.java:107)

at org.openqa.selenium.devtools.Connection.<init>(Connection.java:78)

at org.openqa.selenium.chromium.ChromiumDriver.lambda$new$2(ChromiumDriver.java:116)

at java.base/java.util.Optional.map(Optional.java:260)

at org.openqa.selenium.chromium.ChromiumDriver.<init>(ChromiumDriver.java:114)

at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:82)

at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:50)

at test.FirstTest.main(FirstTest.java:20)


Andrei Solntsev

unread,
May 2, 2023, 10:11:32 AM5/2/23
to seleniu...@googlegroups.com
See, now you will get the help much faster :)

I see you are using a very old version of Selenium - 4.0.0.
But the latest Chrome 112.
This old Selenium version doesn't support the latest Chrome, yes.

You just need to use the latest Selenium. 

Always try this lifehack before asking questions ;) 

Andrei Solntsev


вт, 2 мая 2023 г. в 17:00, Hagay Hazan <hha...@gmail.com>:
Reply all
Reply to author
Forward
0 new messages