2013-08-23 34 views
1

谁能帮助我打开使用硒webdriver的Python中的安全HTTP(HTTPS)的网页?Python中硒的webdriver打开不可信连接

只要打开页面时它显示证书错误“不可信连接”。

我尝试下面的代码,但它并没有为我工作 -

from selenium import webdriver 

profile = webdriver.firefox.firefox_profile.FirefoxProfile() 
#profile.accept_untrusted_certs = 'true' 

profile.default_preferences["webdriver_assume_untrusted_issuer"] = 'false' 
profile.update_preferences() 

browser = webdriver.Firefox(profile) 
browser.get('https://192.168.20.35:8443') 

-

硒webdriver的版本 - 2.35.0

Python版本 - 2.7.2

回答

0

这在浏览器不接受/信任网站证书时出现。要接受certificate火狐,您可以运行此:

ProfilesIni profile = new ProfilesIni(); 
    FirefoxProfile myprofile = profile.getProfile("default"); 
    myprofile.setAcceptUntrustedCertificates(true); 
    myprofile.setAssumeUntrustedCertificateIssuer(true); 
    WebDriver driver = new FirefoxDriver(myprofile); 
相关问题