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. CxGrid如何实现导出Excel 功能

    ExportGrid4ToEXCEL  这个老的版本用的,新的版本引用 cxGridExportLink 这个单元 uses  Windows, Messages, SysUtils, Variant ...

  2. 1808:公共子序列 即POJ 1458 Common Subsequence

    1808:公共子序列 查看 提交 统计 提问 总时间限制:  1000ms 内存限制:  65536kB 描述 我们称序列Z = < z1, z2, ..., zk >是序列X = < ...

  3. [SharePoint 2010] Visual Studio 2010內撰寫視覺化WebPart超簡單

    新一代的Visual Studio 2010對於SharePoint 2010的專案撰寫,有非常另人讚賞的改進. 以往寫一個WebPart要搞好多雜七雜八的步驟,也要硬寫HTML輸出,當然有人說可以寫 ...

  4. 《从零开始学Swift》学习笔记(Day 64)——Cocoa Touch设计模式及应用之目标与动作

    原创文章,欢迎转载.转载请注明:关东升的博客 目标(Target)与动作(Action)是iOS和OS X应用开发的中事件处理机制.   问题提出 如图所示是一个ButtonLabelSample案例 ...

  5. java 从服务器下载文件并保存到本地

    昨天在做一个项目时,用到了从服务器上下载文件并保存到本地的知识,以前也没有接触过,昨天搞了一天,这个小功能实现了,下面就简单的说一下实现过程: 1.基础知识          当我们想要下载网站上的某 ...

  6. Struts2---输入验证

    1. Struts2 的验证 1). 验证分为两种: > 声明式验证* 需要解决的问题如下: >> 确定对哪个 Action 或 Model 的那个字段进行验证 >> 使 ...

  7. Android中可自由移动悬浮窗口的实现

    http://www.xsmile.net/?p=538   调用WindowManager,并设置WindowManager.LayoutParams的相关属性,通过WindowManager的ad ...

  8. MSSQL移除字符串两边的指定字符

    移除字符串左边的字符: CREATE FUNCTION [dbo].[RemoveLeftChar] ( @Expression varchar(max), @char varchar(4))RETU ...

  9. Apache Samza - Reliable Stream Processing atop Apache Kafka and Hadoop YARN

    http://engineering.linkedin.com/data-streams/apache-samza-linkedins-real-time-stream-processing-fram ...

  10. Linux下安装谷歌访问助手,解压缩时出现中文乱码

    1.sudo apt-get install unar 安装unar 2.unar 谷歌访问助手chrome版本.zip   注意:使用 lsar 命令可以查看压缩文件内有那些文件: 例:lsar 谷 ...