0

I am using the latest JBrowserDriver from here: https://github.com/MachinePublishers/jBrowserDriver.

I want to eliminate the "Host name 'foobar' does not match the certificate subject provided by the peer" exception. Here's what I do with org.apache.http.HttpClient:

TrustStrategy trustStrategy = new TrustSelfSignedStrategy();
SSLContext sslContext = SSLContexts.custom().loadTrustMaterial(trustStrategy).build();
HostnameVerifier hostnameVerifier = NoopHostnameVerifier.INSTANCE;

StatusLine statusLine;
try (CloseableHttpClient httpclient = HttpClients.custom().setSSLContext(sslContext).setSSLHostnameVerifier(hostnameVerifier).build()) {
    HttpGet httpGet = new HttpGet(deviceStatusURI);
    ...
}

Is there a way to do something similar with JBrowserDriver?

shackman
  • 11
  • 2

1 Answers1

0

Since version 0.10.2 of JBrowserDriver you can configure if the hostname is verified. To disable verification do the following:

Settings settings = Settings.builder()
        .hostnameVerification(false)
        .build();
JBrowserDriver jBrowserDriver = new JBrowserDriver(settings);
eee
  • 3,241
  • 1
  • 17
  • 34