浏览器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()

  

python SSL处理的更多相关文章

  1. Python‘ssl.match_hostname()’函数SSL证书验证安全绕过漏洞

    漏洞名称: Python‘ssl.match_hostname()’函数SSL证书验证安全绕过漏洞 CNNVD编号: CNNVD-201312-033 发布时间: 2013-12-04 更新时间: 2 ...

  2. Python [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed 解决方法

    一个搭建在SAE上的Django应用,使用新浪微博提供的Python SDK已经稳定运行一年有余,但最近开始持续出现微博认证失败的状况. 摘录微博python SDK的错误提示如下所示: ERROR: ...

  3. python SSL 错误

    python 使用pip 安装模块是提示SSL错误 出现该问题的原因由于系统的openssl是1.0.1的版本,对于python3.7太老了,需要更新为openssl1.0.2或者libressl2. ...

  4. MacOS升级到Monterey后python SSL握手失败问题

    MacOS升级到Monterey 12.0.1后,忽然发现原来工作正常的python3请求华为restconf API报错失败,提示 ssl.SSLError: [SSL: SSLV3_ALERT_H ...

  5. 2019-05-14 Python SSL

    解决SSL报错问题 -- 导库 import ssl import urllib.request context = ssl._create_unverified_context() --用urlli ...

  6. ERROR: The Python ssl extension was not compiled. Missing the OpenSSL lib?

    官方已经给出解决方案:https://github.com/pyenv/pyenv/wiki/Common-build-problems#error-the-python-ssl-extension- ...

  7. Python爬虫连载7-cookie的保存与读取、SSL讲解

    一.cookie的保存与读取 1.cookie的保存-FileCookie.Jar from urllib import request,parse from http import cookieja ...

  8. python虚拟环境的使用

    一. 安装 sudo apt-get install python-virtualenv 二. 创建环境 sudo virtualenv Myenv 创建完全隔离的Python环境,实质是创建了一个文 ...

  9. python爬虫(五)_urllib2:Get请求和Post请求

    本篇将介绍urllib2的Get和Post方法,更多内容请参考:python学习指南 urllib2默认只支持HTTP/HTTPS的GET和POST方法 urllib.urlencode() urll ...

随机推荐

  1. 使用@Valid和BindingResult验证请求参数的合法性并处理校验结果

    /** * 添加用户,使用@RequestBody将请求体映射到Action方法参数中 * 使用@Valid注解验证请求参数的合法性 * 使用BindingResult处理校验结果 * @param ...

  2. Python运维开发基础07-文件基础【转】

    一,文件的基础操作 对文件操作的流程 [x] :打开文件,得到文件句柄并赋值给一个变量 [x] :通过句柄对文件进行操作 [x] :关闭文件 创建初始操作模板文件 [root@localhost sc ...

  3. 题解-AtCoder-agc006C Rabbit Exercise

    Problem AtCoder & bzoj 题意:数轴上有\(n\)个点(初始坐标均为整数),编号为\(1\)~\(n\).给出\(m\)个操作. 每个操作会选定点\(a\),然后随机在点\ ...

  4. HTML中添加音乐video embed audio

    做H5页面时需要添加背景音乐,方法如下 方式一:<video controls="" autoplay="" name="media" ...

  5. python操作三大主流数据库(7)python操作mongodb数据库①mongodb的安装和简单使用

    python操作mongodb数据库①mongodb的安装和简单使用 参考文档:中文版:http://www.mongoing.com/docs/crud.html英文版:https://docs.m ...

  6. Freemaker:操作集合

    <#if (id?index_of('Base') >= 0)> <choose> <when test="rootOrgID !=null and ro ...

  7. JS:判断是否是移动端

    通过User-Agent判断 代码: if(navigator.userAgent.match(/mobile/i)) { //业务层代码 $('body').removeClass("si ...

  8. simulate events

    windows system maintains a msg queue, and any process that supports msg will create an thread that h ...

  9. Java+selenium chrome 常见的问题WebDriverException: unknown error: call function result missing 'value'

    运行chrome浏览器 报错:"main" org.openqa.selenium.WebDriverException: unknown error: call function ...

  10. [C][代码实例]交换指向常量的二级指针的位置

    #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> ...