如何处理硒3中的SSL证书错误?



我正在使用下面提到的代码,但它无法正常工作 Chrome 版本 79:

DesiredCapabilities capability = DesiredCapabilities.chrome();
capability.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
//capability.setCapability("pageLoadStrategy", "none");
System.setProperty("webdriver.chrome.driver","driver//chromedriver.exe"); 
driver = new ChromeDriver(capability); 
//driver.manage().deleteAllCookies(); 
driver.manage().window().maximize();
//Runtime.getRuntime().exec("AutoIT_Exe//AutoIT_Login.exe"); 
driver.get(url);

您可以使用开关忽略此类错误

DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setCapability("chrome.switches", Arrays.asList("--ignore-certificate-errors"));
driver = new ChromeDriver(capabilities);

相关内容

  • 没有找到相关文章