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. poj_1836 动态规划

    题目大意 N个士兵排成一排,不是按照高度顺序排列.现在想要从中去掉几名士兵,从而使得队伍中剩余的士兵能够看到这排最左边或者最右边的那个士兵,某士兵能够看到最左边(或最右边)的士兵指这名士兵和最左边(或 ...

  2. 【BZOJ2253】[2010 Beijing wc]纸箱堆叠 cdq分治

    [BZOJ2253][2010 Beijing wc]纸箱堆叠 Description P 工厂是一个生产纸箱的工厂.纸箱生产线在人工输入三个参数 n p a , , 之后,即可自动化生产三边边长为 ...

  3. 常用 Git 操作

    最新博客链接:https://feiffy.cc/Git 日常用到的GIT的一些操作,记下来,以备参考. 删除文件 git rm filename git commit -m "remove ...

  4. Hibernate的检索方式--查询数据的方式

    Hibernate 提供了以下几种检索对象的方式1导航对象图检索方式: 根据已经加载的对象导航到其他对象(根据已经加载的对象,导航到其他对象-例如一对多的查询)2OID 检索方式: 按照对象的 OID ...

  5. If the parts of an organization (e.g., teams, departments, or subdivisions) do not closely reflect the essential parts of the product, or if the relationship between organizations do not reflect the r

    https://en.wikipedia.org/wiki/Conway%27s_law

  6. FIR Matlab DSP

  7. Java8 中的时间和日期 API

    1. 日期和时间概述 LocalDate,LocalTime,LocalDateTime类的实例是不可变的对象,分别表示使用 ISO-8601 日历系统 的日期,时间,日期和时间;它们提供了简单的日期 ...

  8. django允许外部访问

    默认方法启动django python manage.py runserver 这时启动的服务只能在本机访问,这是因为服务只向本机(127.0.0.1:8000)提供,所以局域网的其他机器不能访问. ...

  9. Linux命令:tac

    全称:concatenate and print files in reverse 用途:将文件全部内容从尾到头反向连续输出到标准输出(屏幕)上 格式:tac [OPTION]... [FILE].. ...

  10. Linux下的内核模块机制

    2017-06-20 Linux的内核模块机制允许开发者动态的向内核添加功能,我们常见的文件系统.驱动程序等都可以通过模块的方式添加到内核而无需对内核重新编译,这在很大程度上减少了操作的复杂度.模块机 ...