Page tree
Skip to end of metadata
Go to start of metadata

Last updated: Sep 28, 2018 21:22

Problem

Sometimes the site with not valid certificate should be accessed by MAC/Safari web browser.

Solution

The code below can be used in order to override Safari security warning and continue the test.

The client can use the following workaround and execute java script command: "CertificateWarningController.visitInsecureWebsiteWithTemporaryBypass()immediately after driver.get command.

Examples:

driver.get("bad ssl website");

JavascriptExecutor js = (JavascriptExecutor)driver;

js.executeScript("CertificateWarningController.visitInsecureWebsiteWithTemporaryBypass()");

or

driver.get("bad ssl website");

driver.executeScript("CertificateWarningController.visitInsecureWebsiteWithTemporaryBypass()");


Note: if no bad SSL error will occur the command will fail with error so it's recommended to wrap this code with try and catch block.