Python- Anacoda环境使用Selenium+ChromeDriver报错
我的系统是win10,python是用Anacoda安装的,通过pip安装了selenium 后使用Chromedriver发现报错,pip安装selenium如下:
pip install selenium
报错具体如下:
driver=webdriver.Chrome()
Traceback (most recent call last):
File "D:\app\Anaconda\lib\site-packages\selenium\webdriver\common\service.py", line , in start
stdin=PIPE)
File "D:\app\Anaconda\lib\subprocess.py", line , in __init__
restore_signals, start_new_session)
File "D:\app\Anaconda\lib\subprocess.py", line , in _execute_child
startupinfo)
FileNotFoundError: [WinError ] 系统找不到指定的文件。 During handling of the above exception, another exception occurred: Traceback (most recent call last):
File "<stdin>", line , in <module>
File "D:\app\Anaconda\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line , in __init__
self.service.start()
File "D:\app\Anaconda\lib\site-packages\selenium\webdriver\common\service.py", line , 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
selenium操作chrome浏览器需要有ChromeDriver驱动来协助。
解决办法:
1.下载Chromedriver,网盘:https://pan.baidu.com/s/1c3KLRJa
2.把Chromedriver解压到D:\app\Anaconda\Scripts\下,重新运行命令即可打开Chromedriver
在运行了
driver=webdriver.Chrome()
driver.get('www.baidu.com')
之后出现报错:
>>> driver.get('m.weibo.com')
Traceback (most recent call last):
File "<stdin>", line , in <module>
File "D:\app\Anaconda\lib\site-packages\selenium\webdriver\remote\webdriver.py", line , in get
self.execute(Command.GET, {'url': url})
File "D:\app\Anaconda\lib\site-packages\selenium\webdriver\remote\webdriver.py", line , in execute
self.error_handler.check_response(response)
File "D:\app\Anaconda\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line , in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: chrome not reachable
(Session info: chrome=63.0.3239.132)
(Driver info: chromedriver=2.31. (092de99f48a300323ecf8c2a4e2e7cab51de5ba8),platform=Windows NT 10.0. x86_64)
原因是打开的域名一定要加前http://,改正后如下:
Python- Anacoda环境使用Selenium+ChromeDriver报错的更多相关文章
- python中引入包的时候报错AttributeError: module 'sys' has no attribute 'setdefaultencoding'解决方法?
python中引入包的时候报错:import unittestimport smtplibimport timeimport osimport sysimp.reload(sys)sys.setdef ...
- selenium启动报错“ incorrect JSON status mapping for 'unknown error' (500 expected)”
前面讲了工程启动报错“selenium启动报错Unable to read VR Path Registry from C:\Users\clinva\AppData\Local\openvr\ope ...
- selenium+phantomjs报错:Unable to find a free port的分析和解决
selenium+phantomjs报错:Unable to find a free port的分析和解决 Table of Contents 1. 现象 2. 分析 3. 解决办法 1 现象 在做项 ...
- vuejs npm chromedriver 报错
vuejs npm chromedriver 报错 # 全局安装 vue-cli$ npm install -g vue-cli# 创建一个基于 "webpack" 模板的新项 ...
- 记一次用python 的ConfigParser读取配置文件编码报错
记一次用python 的ConfigParser读取配置文件编码报错 ...... raise MissingSectionHeaderError(fpname, lineno, line)Confi ...
- python+selenium运行报错UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-1: ordinal not in range(128)
使用python+selenium运行自动化脚本时,打印某一段文字出现UnicodeEncodeError: 'ascii' codec can't encode characters in posi ...
- python selenium phantomjs 报错
报错: webdriver.PhantomJS() raise exception_class(value)selenium.common.exceptions.WebDriverException: ...
- selenium+python自动化85-python3.6上SendKeys报错用PyUserInput取代
前言 python2上安装SendKeys库,对于不好定位的元素,用快捷键操作是极好的,那么在3.6上安装时,会报错 python3.6安装SendKeys报错 1.python3.6安装SendKe ...
- 使用Selenium模块报错的解决办法 (FileNotFound,WebDriverException)
添加Chrome浏览器程序的目录到系统Path变量中: C:\Users\%USERNAME%\AppData\Local\Google\Chrome\Application ,使用pip3 inst ...
随机推荐
- C# SqlBulkCopy类批量导入数据
特别注意 sqlbulkcopy.ColumnMappings.Add(dt.Columns[i].ColumnName, dt.Columns[i].ColumnName); 插入的时候列的顺序可 ...
- 使用phpize建立php扩展(Cannot find config.m4)
php源码:/root/soft/php-5.3.4php安装: /usr/local/php [root@ns root]# phpizeCannot find config.m4.Make sur ...
- nginx反向代理带路径访问问题
nginx的配置为192.168.0.219:80分别映射到upstream组192.168.0.55:8080和192.168.0.206:8080,那如何配置做到访问192.168.0.219:8 ...
- 《Python基础教程》第20章学习笔记
python实现:https://github.com/captainwong/instant_markup c++实现:https://github.com/captainwong/instant_ ...
- JSP 表单处理向服务器提交信息
JSP 表单处理 我们在浏览网页的时候,经常需要向服务器提交信息,并让后台程序处理.浏览器中使用 GET 和 POST 方法向服务器提交数据. GET 方法 GET方法将请求的编码信息添加在网址后面, ...
- xml schema复杂类型
xml schema复杂类型 对于复杂类型,xs:complexType, xs:sequence子节点必须有. <?xml version="1.0"?> <x ...
- COM组件多接口对象模型
COM组件有两种接口类型,Dual and Custom,如下图所示.本文说的是Custom.所谓多接口COM对象是指此COM对象实现了多于一个的自定义接口,即Custom接口. 接口图如下: 需要注 ...
- poj1861 最小生成树 prim & kruskal
// poj1861 最小生成树 prim & kruskal // // 一个水题,为的仅仅是回味一下模板.日后好有个照顾不是 #include <cstdio> #includ ...
- Objective-C 和 Core Foundation 对象相互转换的内存管理总结
本文转载至 http://blog.csdn.net/allison162004/article/details/38756649 OS允许Objective-C 和 Core Foundation ...
- 第二课 创建http server
nodejs 不需要单独安装服务器软件 tomcat .apache. iis 看下面的代码创建了http服务器,并输出一些简单的响应内容 //引入http 模块 var http = require ...