浏览器SSL提示 我们看一下IE的解决方案,对ie浏览器而言,需要添加Desired Capabilities的acceptSslCerts选项为True,代码如下: 的 112 / 166 #_*_ coding:utf-8 _*_ __author__ = '苦叶子' from selenium import webdriver if __name__ == '__main__': capabilities = webdriver.DesiredCapabilities().INTERNETEXPLORER capabilities['acceptSslCerts'] = True driver = webdriver.Ie(capabilities=capabilities) driver.get(u'https://cacert.org/') print driver.title driver.quit() 对于firefox浏览器则需要添加FirefoxProfile()的accept_untrusted_certs的选项为True,示例代码如下: #_*_ coding:utf-8 _*_ __author__ = '苦叶子' from selenium import webdriver if __name__ == '__main__': profile=webdriver.FirefoxProfile() profile.accept_untrusted_certs=True driver=webdriver.Firefox(firefox_profile=profile) 113 / 166 driver.get(u'https://cacert.org/') driver.close() 对于chrome浏览器则需要添加ChromeOptions()的--ignore-certificate-errors选项为True,示例代码如下: #_*_ coding:utf-8 _*_ __author__ = '苦叶子' from selenium import webdriver if __name__ == '__main__': options=webdriver.ChromeOptions() options.add_argument('--ignore-certificate-errors') driver=webdriver.Chrome(chrome_options=options) driver.get(u'https://cacert.org/') driver.close()