我的系统是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驱动来协助。

 
什么是ChromeDriver?
ChromeDriver是Chromium team开发维护的,它是实现WebDriver有线协议的一个单独的服务。ChromeDriver通过chrome的自动代理框架控制浏览器,ChromeDriver只与12.0.712.0以上版本的chrome浏览器兼容。

解决办法:

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报错的更多相关文章

  1. python中引入包的时候报错AttributeError: module 'sys' has no attribute 'setdefaultencoding'解决方法?

    python中引入包的时候报错:import unittestimport smtplibimport timeimport osimport sysimp.reload(sys)sys.setdef ...

  2. 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 ...

  3. selenium+phantomjs报错:Unable to find a free port的分析和解决

    selenium+phantomjs报错:Unable to find a free port的分析和解决 Table of Contents 1. 现象 2. 分析 3. 解决办法 1 现象 在做项 ...

  4. vuejs npm chromedriver 报错

    vuejs npm chromedriver 报错   # 全局安装 vue-cli$ npm install -g vue-cli# 创建一个基于 "webpack" 模板的新项 ...

  5. 记一次用python 的ConfigParser读取配置文件编码报错

    记一次用python 的ConfigParser读取配置文件编码报错 ...... raise MissingSectionHeaderError(fpname, lineno, line)Confi ...

  6. 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 ...

  7. python selenium phantomjs 报错

    报错: webdriver.PhantomJS() raise exception_class(value)selenium.common.exceptions.WebDriverException: ...

  8. selenium+python自动化85-python3.6上SendKeys报错用PyUserInput取代

    前言 python2上安装SendKeys库,对于不好定位的元素,用快捷键操作是极好的,那么在3.6上安装时,会报错 python3.6安装SendKeys报错 1.python3.6安装SendKe ...

  9. 使用Selenium模块报错的解决办法 (FileNotFound,WebDriverException)

    添加Chrome浏览器程序的目录到系统Path变量中: C:\Users\%USERNAME%\AppData\Local\Google\Chrome\Application ,使用pip3 inst ...

随机推荐

  1. org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.jdbc.BadSqlGrammarException: Unknown column 'viewpoint' in 'field list'

    问题描述:当我在model中添加了一下代码以后数据库报错: 添加的代码为: private Viewpoint viewpoint; public Viewpoint getViewpoint() { ...

  2. Mac OS X 安装Ruby

    安装CocoaPods第一步 起因:重装系统后需要重新安装CocoaPods网上搜了下发现很多都过时了,已经不能用了.而且taobao Gems源已经停止服务,现在有ruby-china提供服务 PS ...

  3. Disruptor 创建过程

    1 Disruptor disruptor = new Disruptor<ValueEvent>(ValueEvent.EVENT_FACTORY, ringBufferSize, ex ...

  4. KiB、MiB与KB、MB的区别

    原来没太注意MB与MiB的区别,甚至没太关注还有MiB这等单位,今天认真了一下,发现两者还是有区别的,具体的差别是MB等单位以10为底数的指数,MiB是以2为底数的指数,如:1KB=10^3=1000 ...

  5. 关于ES6的let,const与var之间的三生三世

    首先需要明确的是let.const.var都是用来定义变量的 在ES6之前,我们一般都用var来定义变量,例如 : function test(){ var i=1; console.log(i); ...

  6. Cocos2d-x中使用第三方so库

    项目中假设使用到第三方的SDK,大多数是以.so动态共享库的文件打包给我们使用.怎样使用他们,见以下分析. 1.获得库文件 假如我们得到的库文件是libxxx.so(注:关于.so文件的命名方式,可百 ...

  7. HDFS上传机制

  8. 【python】-- 基本语法、循环

    数据类型 1.数字: int(整型) 在32位机器上,整数的位数为32位,取值范围为-2**31-2**31-1,即-2147483648-2147483647 在64位系统上,整数的位数为64位,取 ...

  9. 【python】-- 面向对象引子、概念

    面向过程编程 1.编程范式 编程是 程序 员 用特定的语法+数据结构+算法组成的代码来告诉计算机如何执行任务的过程 , 一个程序是程序员为了得到一个任务结果而编写的一组指令的集合,正所谓条条大路通罗马 ...

  10. ABAP 内表

    定义内表 1. 先声明表结构, 再根据表结构定义内表.   TYPES: BEGIN OF w_itab, a(10), b(10), END OF w_itab. DATA: itab1 type ...