What happened?
When trying to connect a jdk http client webdriver to a grid using a proxy (with authentication) I get a java.lang.NullPointerException.
How can we reproduce the issue?
System.setProperty("webdriver.http.factory", "jdk-http-client");
ChromeOptions browserOptions = new ChromeOptions();
browserOptions.setPlatformName("Linux");
java.net.Authenticator auth = new java.net.Authenticator() {
public PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication("username", "pwd".toCharArray());
}
};
java.net.Authenticator.setDefault(auth);
Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("proxy", port));
ClientConfig config = ClientConfig.defaultConfig()
.connectionTimeout(Duration.ofSeconds(45))
.readTimeout(Duration.ofSeconds(45))
.proxy(proxy)
.baseUrl(new URL("gridUrl"));
HttpCommandExecutor executor = new HttpCommandExecutor(config);
WebDriver driver = new RemoteWebDriver(executor, browserOptions);
Relevant log output
Caused by: java.lang.NullPointerException
at java.base/java.io.ByteArrayInputStream.<init>(ByteArrayInputStream.java:108)
at org.openqa.selenium.remote.http.jdk.JdkHttpMessages.lambda$createResponse$4(JdkHttpMessages.java:149)
at org.openqa.selenium.remote.http.Contents.bytes(Contents.java:80)
at org.openqa.selenium.remote.http.Contents.string(Contents.java:97)
at org.openqa.selenium.remote.http.Contents.string(Contents.java:101)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:131)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:106)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:67)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:156)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:535)
... 3 more
Operating System
Windows 10
Selenium version
Java 4.7.2
What are the browser(s) and version(s) where you see this issue?
all
What are the browser driver(s) and version(s) where you see this issue?
all
Are you using Selenium Grid?
No response
What happened?
When trying to connect a jdk http client webdriver to a grid using a proxy (with authentication) I get a java.lang.NullPointerException.
How can we reproduce the issue?
Relevant log output
Operating System
Windows 10
Selenium version
Java 4.7.2
What are the browser(s) and version(s) where you see this issue?
all
What are the browser driver(s) and version(s) where you see this issue?
all
Are you using Selenium Grid?
No response