I have Selenium tests where I'm using ChromeDriver to go to https://localhost:<port>
. The port number in this case is using a self-signed certificate to support HTTPS connection.
However, when ChromeDriver opens and tries to navigate to that localhost address, Chrome gives an error screen ERR_SSL_PROTOCOL_ERROR as seen in screenshot below.
I did some research and found that adding the switches --allow-insecure-localhost
and --ignore-certificate-errors
to the capabilities object for the WebDriver instance. This question/answer gave me some ideas. My code for creating the capabilities is:
ChromeOptions options = new ChromeOptions();
// Other capabilities here
options.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
options.setCapability(CapabilityType.ACCEPT_INSECURE_CERTS, true);
options.addArguments("--allow-insecure-localhost", "--ignore-certificate-errors");
Nonetheless, I still get the same error screen when the ChromeDriver instance tries to navigate to localhost.
I'm using ChromeDriver 84.0.4147.30 and Google Chrome Version 84.0.4147.89
How do I resolve this issue?