【Python 解决错误】selenium.common.exception.WebDriverException
近来准备写个脚本去搜索某端游的官网交易平台。因为也不懂高端的爬虫技术,决定用selenium去戳。这里采用的是chrome浏览器,链接网页时报错:
File "C:\Python37\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 73, in __init__
self.service.start()
File "C:\Python37\lib\site-packages\selenium\webdriver\common\service.py", line 83, in start
os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home
解决办法:
安装与浏览器版本匹配的webdriver
1、打开谷歌浏览器, 在地址栏输入 chrome://version/ 查看版本信息,我的版本信息描述如下:
| Google Chrome | 72.0.3626.119 (正式版本) (32 位) (cohort: Stable) |
| 修订版本 | 9a65993e2cde1b5797ec98da4cd9abcea464cd7b-refs/branch-heads/3626@{#876} |
| 操作系统 | Windows |
2、选择合适版本的驱动下载, 如果没有完全匹配的就选最相似匹配的版本下载。(比如我的版本没有完全匹配的,我选了一个临近的驱动,也可用)
下载地址:
http://chromedriver.storage.googleapis.com/index.html

3、解压下载的驱动放到指定目录,代码调用时指定该目录即可。
我把它放在了selenium下的chrome了,代码演示如下
from selenium import webdriver chrome_driver = r"C:\Python37\Lib\site-packages\selenium\webdriver\chrome\chromedriver.exe"
browser = webdriver.Chrome(executable_path=chrome_driver)
成功解决问题!
【Python 解决错误】selenium.common.exception.WebDriverException的更多相关文章
- 解决selenium.common.exception.WebDriverException:Message:'chromedriver' executable needs to be in Path
'chromedriver' executable needs to be in Path 声明:本人萌新,刚学python不久记录一下自己的坑,发出来若能帮助到一些人尽早解决问题那便是极好的,( ̄▽ ...
- python 安装selenium首次运行错误selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH
问题原因: 没有安装相关的支撑driver https://npm.taobao.org/mirrors/chromedriver/ 下载对应的driver 放置到python路径下
- 解决selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in P
转载 解决selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be i ...
- python+selenium,打开浏览器时报selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH
有一年多没写web自动化了,今天搭建环境的时候报了一个常见错误,但是处理过程有点闹心,报错就是常见的找不到驱动<selenium.common.exceptions.WebDriverExcep ...
- python无法启动火狐浏览器且报错“selenium.common.exceptions.WebDriverException: Message: Unable to find a matching set of capabilities”
安装了python2,使用pip安装了selenium,但是在使用时,报了“selenium.common.exceptions.WebDriverException: Message: 'gecko ...
- selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH. 错误处理方法
首次使用selenium webdriver,webdriver.Firefox() 报错selenium.common.exceptions.WebDriverException: Message: ...
- 【Python + Selenium】初次用IE浏览器之报错:selenium.common.exceptions.WebDriverException: Message: Unexpected error launching Internet Explorer. Protected Mode settings are not the same for all zones.
初次用IE浏览器运行自动化程序时,报错:selenium.common.exceptions.WebDriverException: Message: Unexpected error launchi ...
- centos7 selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH
1.查看安装的chrome浏览器版本 2.查看版本对应的驱动 https://sites.google.com/a/chromium.org/chromedriver/downloads 下载后拷贝到 ...
- robotframework执行用例时,报错selenium.common.exceptions.WebDriverException: Message: unknown error: cannot get automation extension from unknown error: page could not be found: chrome-extension://aapnijgdinl
在用robotframework编写移动端测试用例(用chrome浏览器模拟手机浏览器),执行用例时, 报错selenium.common.exceptions.WebDriverException: ...
随机推荐
- javascript总结39: 元素获取的常见问题
1 定义id属性的元素,不获取直接使用 由于id名具有唯一性,部分浏览器支持直接使用id名访问元素,但不是标准方式,生产环境下不推荐使用. 2 元素是对象 获取到的元素是DOM对象 ,DOM对象也有数 ...
- Activator不能创建包含范型参数的实例
Activator包含特定的方法,用以在本地或从远程创建对象类型,或获取对现有远程对象的引用.此类不能被继承. 具体介绍:http://msdn.microsoft.com/zh-cn/library ...
- Cannot change version of project facet Dynamic Web Module to 2.4.
解决办法,找到项目目录,将.settings target .classpath .project 删除 重新引入项目 原因是 web.xml 文件里<web-app 里的与.settin ...
- spark 编译命令
mvn -Pyarn -Phadoop-2.4 -Dhadoop.version=2.4.0 -DskipTests clean package
- 双系统Grub引导下恢复windows引导的方法
此方法适用于windows系统正常,linux和windows 双系统下恢复windows系统引导.需要使用windows安装u盘 1. 启动至windows安装u盘,点击修复计算机 2. 进入命令行 ...
- AgentJob--修改操作系统时间对Job的影响
场景:有一个数据库作业每10分钟运行一次,在系统管理员修改操作系统时间后,作业长时间未运行. 分析:作业最后一次运行时间是 10:20,按照作业的计划,下一次的运行时间为 10:30,而系统管理员修改 ...
- docker+selenium Grid搭建自动化分布式测试环境
自动化测试需要考虑到兼容性的时候,之前的做法是每个执行机上安装不同版本的浏览器,实际上这样做会很浪费硬件资源,现在有了docker容器化技术,让一切变得简单. 工具清单: 语言:python 2.7 ...
- MFC学习(三):项目学习
1. 概述 MFC程序由CWinApp.MainFrm(含Menu,可用CSplitterWndEx分割).众多Dialog等组成. MFC既可以使用纯Dialog的形式,也可以使用Document+ ...
- sqlite初识
最近在部署PHP网站项目的时候,发现项目并没有使用传统的三大关系型数据库,而是采用了sqlite数据库,以前的时候,也见过sqlite,但是并没有深入了解其功能和用法,好奇心驱使,决定好好研究一下sq ...
- Session概述
session即HttpContext.Session 属性,命名空间System.Web 我们都知道,Cookie信息全部存放于客户端,Session则只是将一个ID存放在客户端做为与服务端验证的标 ...