如何处理Selenium中的Chrome浏览器中的SSL证书问题?
开发网站时,其SSL证书不正确。
该站点可能具有自签名证书。
无法在服务器级别正确配置SSL。
示例
import org.openqa.selenium.Capabilities;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
public class SSLCert {
public static void main(String[] args) {
//TODO自动生成的方法存根
//一般镀铬型材所需的功能
DesiredCapabilities c=DesiredCapabilities.chrome();
c.setCapability(CapabilityType.ACCEPT_INSECURE_CERTS, true);
c.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
//适用于本地浏览器的ChromeOptions-
ChromeOptions ch= new ChromeOptions();
ch.merge(c);
System.setProperty("webdriver.chrome.driver", "C:\\Users\\ghs6kor\\Desktop\\Java\\chromedriver.exe");
WebDriver driver=new ChromeDriver(ch);
}
}热门推荐
10 儿子立冬祝福语简短独特
11 对当兵的祝福语简短
12 侄儿高考试祝福语简短
13 伴郎红包祝福语朋友简短
14 媳妇生日简短祝福语朋友
15 公司年会祝福语简短最好
16 元旦感恩祝福语简短大全
17 红包祝福语简短10字
18 周六早晨祝福语简短