【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: ...
随机推荐
- spark读写Sequoiadb
spark如何读写Sequoiadb,最近被客户问多了,这个记录下. Spark读Sequoiadb数据: package marketing import com.sequoiadb.hadoop. ...
- TF Boys (TensorFlow Boys ) 养成记(五): CIFAR10 Model 和 TensorFlow 的四种交叉熵介绍
有了数据,有了网络结构,下面我们就来写 cifar10 的代码. 首先处理输入,在 /home/your_name/TensorFlow/cifar10/ 下建立 cifar10_input.py,输 ...
- CTE递归限制次数
CTE可以用来取递归,网上资料很多,这里就不再叙述了,今天遇到的需求是要限制只取2级,然后加了个临时的lev with tree as(select [CustomerID],[CustomerNam ...
- org.slf4j.impl.SimpleLoggerFactory cannot be cast to ch.qos.logback.classic.LoggerContext
查看日志信息: SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/app/a ...
- List of HTTP header fields
https://en.wikipedia.org/wiki/List_of_HTTP_header_fields Content-Type The MIME type of the body of t ...
- Delphi 实现 图灵机器人API(IDHTTP POST )
此功能所需的 Key及接口文档,都可以在图灵机器人的官网下载, 小伙伴们需要申请自己的图灵机器人账号. 申请方法请自行百度“图灵机器人” . 登录账号后,在左侧的[机器人接入],获取需要的信息,记得 ...
- 让PHP更快的提供文件下载 【转】
一般来说, 我们可以通过直接让URL指向一个位于Document Root下面的文件, 来引导用户下载文件. 但是, 这样做, 就没办法做一些统计, 权限检查, 等等的工作. 于是, 很多时候, ...
- Docker 1.3.3/1.4.0 发布下载,Linux 容器引擎
Docker 1.3.3 发布,下载地址: https://github.com/docker/docker/archive/v1.3.3.zip 改进记录包括: Security Fix path ...
- 慎用uniapp开发商业级应用
官方的社区反馈问题只给解决简单的前端问题,涉及到IDE的问题长期没人回复没人认领 官方公布的各渠道联系方式都得不到回复,先后出现了两个无法解决的问题 第一个问题(现在你都可以去他们社区搜索,没人回复没 ...
- Mysql链接字符串问题
<add key="ConnstringMySql" value="server=xxx.xxx.xxx.xxx;database=YourDatabase;uid ...