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 ...
随机推荐
- python 用win32修改注册表,修改打开IE浏览器的配置
打开注册表:win+r, regedit,注册表的管理是按照文件夹的形式的. 注册表总共有五项: HKEY_CLASSES_ROOT 是HKEY_LOCAL_MACHINE\Software的子项,保 ...
- Unicode utf8等编码类型的原理
1.ASCII码 我们知道,在计算机内部,所有的信息最终都表示为一个二进制的字符串.每一个二进制位(bit)有0和1两种状态,因此八个二进制位就可以组合出256种状态,这被称为一个字节(byte). ...
- route 命令
Linux系统的route命令用于显示和操作IP路由表(show / manipulate the IP routing table).要实现两个不同的子网之间的通信,需要一台连接两个网络的路由器,或 ...
- ARM初学引导_转
一直都在听说ARM有多么好,有多神奇,有多难学.故学它时都兴奋加恐惧.呵呵,我刚好用ARM也有一段时间了.写点东西给ARM的初学者,希望能起到帮助作用. 1,记住:ARM很简单,就如从51转换到PIC ...
- Mysql CAST()函数
(1).CAST()函数的参数是一个表达式,它包括用AS关键字分隔的源值和目标数据类型.以下例子用于将文本字符串'12'转换为整型: SELECT CAST('12' AS int) (2).返回 ...
- Java -- 数字
@.运用BigDecimal处理Double类型的算术运算的精度问题 原文:https://blog.csdn.net/j754379117/article/details/52238396 可使用 ...
- 【hiho一下】第一周 最长回文子串
题目1:最长回文子串 题目原文:http://hihocoder.com/contest/hiho1/problem/1 [题目解读] 题目与 POJ 3974 palindrome 基本同样.求解最 ...
- Storm编程模型及Worker通信机制
1.编程模型 2.Worker通信机制
- EF之POCO应用系列2——复杂类型
在.NET开发中,EF4以前的版本以及LINQ TO SQL都不支持complex数据类型,EF4终于支持complex类型的数据了,这意味着微软的EF框架朝领域驱动方面又迈了一大步. 复杂的数据类型 ...
- A vectorized example
http://cs231n.stanford.edu/slides/2017/cs231n_2017_lecture4.pdf