Allowing Untrusted SSL Certificates with Opera bro

2019-08-29 08:16发布

问题:

How can I allow by Selenium WebDriver to accept untrusted certificate on Opera browser?

I try to use this code. No positive results

DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
WebDriver driver = new OperaDriver(capabilities);

回答1:

Make a custom profile for your opera browser and then set the capability

DesiredCapabilities capabilities = DesiredCapabilities.opera();
capabilities.setCapability("opera.profile", new OperaProfile("/path/to/existing/profile"));
capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
WebDriver driver = new OperaDriver(capabilities);