浏览器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. css - 盒子内外边距

    css - 盒子内外边距 元素内边距 内边距是指元素包含的内容离元素边框之间的间距,padding会撑大盒子.在浏览器中显示的元素宽高包含了padding. div{     width:200px; ...

  2. linux上安装Docker(非常简单的安装方法)

    Docker的三大核心概念:镜像.容器.仓库 镜像:类似虚拟机的镜像.用俗话说就是安装文件. 容器:类似一个轻量级的沙箱,容器是从镜像创建应用运行实例, 可以将其启动.开始.停止.删除.而这些容器都是 ...

  3. 基于keepalived搭建MySQL热机集群

    背景 MySQL的高可用方案一般有如下几种: keepalived+双主,MHA,MMM,Heartbeat+DRBD,PXC,Galera Cluster 比较常用的是keepalived+双主,M ...

  4. [转] 浅谈Trie树(字典树)

    原文地址:https://www.cnblogs.com/TheRoadToTheGold/p/6290732.html Trie树(字典树) 一.引入 字典是干啥的?查找字的. 字典树自然也是起查找 ...

  5. Python笔记 【无序】 【三】

    #打开文件 os.open(file, flags[, mode]); file -- 要打开的文件 flags -- 该参数可以是以下选项,多个使用 "|" 隔开: os.O_R ...

  6. 为什么要重写equals和hashcode方法

    equals hashcode  当新建一个java类时,需要重写equals和hashcode方法,大家都知道!但是,为什么要重写呢? 需要保证对象调用equals方法为true时,hashcode ...

  7. 【转】数据库介绍(MySQL安装 体系结构、基本管理)

    [转]数据库介绍(MySQL安装 体系结构.基本管理) 第1章 数据库介绍及mysql安装 1.1 数据库简介 数据库,简而言之可视为电子化的文件柜——存储电子文件的处所,用户可以对文件中的数据运行新 ...

  8. web前端之性能

    1.避免布局抖动 function resizeAllParagraphsToMatchBlockWidth() { // Puts the browser into a read-write-rea ...

  9. mongdb中的_id

    MongoDB中数据的基本单元称为文档(Document).文档是MongoDB的核心概念,多个键极其关联的值有序的放置在一起便是文档. 在一个特定集合内部,需要唯一的标识文档.因此MongoDB中存 ...

  10. jQuery.extend()参数

    非原创,转载仅供学习 在处理插件参数的接收上,通常使用jQuery的extend方法.extend方法传递单个对象的情况下,这个对象会合并到jQuery身上,而当用extend方法传递一个以上的参数时 ...