Python3.x:chrome运行webdriver脚本提示--ignore-certificate-errors

1,分析原因:

 

 根本原因是Chromedriver和Chrome的版本不兼容;

 网上很多方案说加上如下代码可以解决,但是我试过了Chromedriver和Chrome的版本不兼容加上这段代码一样解决不了,兼容了不用这段代码也可以正常显示:

from selenium import webdriver
options = webdriver.ChromeOptions()
options.add_experimental_option("excludeSwitches",["ignore-certificate-errors"])
options.add_argument('test-type')
browser = webdriver.Chrome(chrome_options=options)

2,解决方案:

 chromedriver下载地址:http://chromedriver.storage.googleapis.com/index.html

 chromedriver与chrome的对应关系表:

解压压缩包,找到chromedriver.exe复制到chrome的安装目录(其实也可以随便放一个文件夹)。复制chromedriver.exe文件的路径并加入到电脑的环境变量中去。

例如:双击PATH,将你的文件位置(C:\Users\my\AppData\Local\Google\Chrome\Application)添加到后面;

完成后在cmd下输入chromedriver验证是否安装成功:

3,python3.x实例代码:

from selenium import webdriver
options = webdriver.ChromeOptions()
options.add_experimental_option("excludeSwitches",["ignore-certificate-errors"])
options.add_argument('test-type')
browser = webdriver.Chrome(chrome_options=options) #driver = webdriver.Chrome()
browser.get("http://www.baidu.com") print('success')

 或者

from selenium import webdriver

browser = webdriver.Chrome()
browser.get("http://www.baidu.com") print('success')

 以上两种方式都可以实现;

4,结果:

测试版本供参考:chromedriver v2.34与chrome v61

Python3.x:chrome运行webdriver脚本提示--ignore-certificate-errors的更多相关文章

  1. python3:cmd运行python脚本,提示 No module named 'xxx'

    问题:cmd窗口运行python脚本,报错 C:\Users\xxx\Documents\GitHub\python3\main>python run_test.pyTraceback (mos ...

  2. Linux运行shell脚本提示No such file or directory错误的解决办法

    Linux执行.sh文件,提示No such file or directory的问题: 原因:在windows中写好shell脚本测试正常,但是上传到 Linux 上以脚本方式运行命令时提示No s ...

  3. Firefox上运行自动化测试脚本提示元素无法点击“WebDriverException: Message: Element is not clickable at point“解决方法

    1. Firefox上运行脚本时提示“WebDriverException: Message: Element is not clickable at point (934.316650390625, ...

  4. Python3 + selenium + Chrome浏览器(webdriver.Chrome()报错)

    Python3 + selenium + Chrome浏览器 Error: selenium.common.exceptions.WebDriverException: Message: 'chrom ...

  5. Chrome扩展开发之二——Chrome扩展中脚本的运行机制和通信方式

    目录: 0.Chrome扩展开发(Gmail附件管理助手)系列之〇——概述 1.Chrome扩展开发之一——Chrome扩展的文件结构 2.Chrome扩展开发之二——Chrome扩展中脚本的运行机制 ...

  6. 安卓8.0真机运行appium1.4遇到的问题:运行自动化脚本,手机自动安装 settings.apk和unclock.apk,执行脚本时提示安装UnicodeIME-debug.apk失败,怎么关掉自动安装?

    运行自动化脚本,手机自动安装 settings.apk和unclock.apk,执行脚本时提示安装UnicodeIME-debug.apk失败,怎么关掉自动安装? 这3个apk的目录分别是: D:\P ...

  7. 开发中运行mysql脚本,发现提示mysql提示Column count doesn't match value count at row 1错误

    开发中运行mysql脚本,发现提示mysql提示Column count doesn't match value count at row 1错误, 调试后发现是由于写的SQL语句里列的数目和后面的值 ...

  8. selenium+chromeDriver配合使用(运行js脚本)

    在python中调用selenium,访问百度,并运行js脚本爬取内容 python入口程序 from selenium import webdriver import time with open( ...

  9. python3读取chrome浏览器cookies

    好几年前我在做一些自动化的脚本时,脑子里也闪过这样的想法:能不能直接把浏览器的cookies取出来用呢? 直到昨天看到代码<python模拟发送动弹>,想起来当年我也曾经有类似的想法没能完 ...

随机推荐

  1. ORA-01102的解决办法

    启动数据库时报错了! SQL> startup mount ORACLE instance started. Total System Global Area  608174080 bytes ...

  2. GIF动画录制工具(写教程时用的比较小巧的gif工具)

    1  软件小巧实用,只有1m 2  gif效果还可以 3  绿色,无需安装 很多地方能下载,百度就行. 下载地址: http://www.downxia.com/downinfo/41427.html

  3. js i++ 与 ++i 的区别

    转载:http://blog.csdn.net/hjb2722404/article/details/50423804 在javascript中,我们常常搞不懂i++与++i的区别,今天我们就来简单说 ...

  4. java基础之Flex弹性布局、JSP错误处理以及Log4J

    一.Flex弹性布局 1.产生的比较晚,目前在移动网页开发中可以使用,而且逐渐成为主流. 在桌面网页开发中使用的比较少(主要是桌面浏览器的兼容性问题更加严重) 2.开启方法: 在容器标签上加上 dis ...

  5. [iOS微博项目 - 4.2] - 设置转发微博背景

    github: https://github.com/hellovoidworld/HVWWeibo A.转发微博部分的淡灰色背景 1.需求 转发微博部分需要设置背景色 使用图片作为背景   2.思路 ...

  6. where both the key and the value are strings

    Environment Variables (The Java™ Tutorials > Essential Classes > The Platform Environment) htt ...

  7. 虚拟网卡 TUN/TAP 驱动程序设计原理

    简介 虚拟网卡Tun/tap驱动是一个开源项目,支持很多的类UNIX平台,OpenVPN和Vtun都是基于它实现隧道包封装.本文将介绍tun/tap驱动的使用并分析虚拟网卡tun/tap驱动程序在li ...

  8. Storm-源码分析- Disruptor在storm中的使用

    Disruptor 2.0, (http://ifeve.com/disruptor-2-change/) Disruptor为了更便于使用, 在2.0做了比较大的调整, 比较突出的是更换了几乎所有的 ...

  9. PostgreSQL学习手册-模式Schema(转)

    原文:http://www.cnblogs.com/stephen-liu74/archive/2012/04/25/2291526.html 一个数据库包含一个或多个命名的模式,模式又包含表.模式还 ...

  10. Ubuntu 12.04安装Google Chrome(转)

    下载google chrome deb包,下载地址:https://www.google.com/chrome/browser/desktop/index.html,google的网站被墙了,如果你下 ...