Ash*_*hok 7 java firefox selenium webdriver
我正在使用webdriver V 3.0.1和firefox V 46.我正面临一个错误,因为"你的连接不安全".
请帮助我克服这个问题.您可以在下面找到我的代码
System.setProperty("webdriver.gecko.driver","D:\\Software\\Webdriver\\gecko new\\geckodriver-v0.11.1-win64\\geckodriver.exe");
FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("network.proxy.type", 0);
profile.setAcceptUntrustedCertificates(true);
profile.setAssumeUntrustedCertificateIssuer(false);
WebDriver driver = new FirefoxDriver(profile);
driver.get("http://qa.applications.marykayintouch.com/Login/Login.aspx");
Run Code Online (Sandbox Code Playgroud)
似乎 SSLCertificates 错误 只需尝试编辑功能
ProfilesIni profiles = new ProfilesIni();
System.setProperty("webdriver.firefox.profile","custom firefox profile name");
String browser_profile = System.getProperty("webdriver.firefox.profile");
FirefoxProfile profile = profiles.getProfile(browser_profile);
profile.setAcceptUntrustedCertificates (true);
webdriver = new FirefoxDriver(profile);
Run Code Online (Sandbox Code Playgroud)
或者
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
driver = new FirefoxDriver(capabilities);
Run Code Online (Sandbox Code Playgroud)
或者
DesiredCapabilities capabilities = new DesiredCapabilities();
ProfilesIni profiles = new ProfilesIni();
System.setProperty("webdriver.firefox.profile","custom firefox profile name");
String browser_profile = System.getProperty("webdriver.firefox.profile");
FirefoxProfile profile = profiles.getProfile(browser_profile);
profile.setAcceptUntrustedCertificates(true);
capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
capabilities.setCapability(FirefoxDriver.PROFILE, profile);
webdriver = new FirefoxDriver(capabilities);
Run Code Online (Sandbox Code Playgroud)
希望它有效。
归档时间: |
|
查看次数: |
5235 次 |
最近记录: |