我的系统是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. Nginx服务启动脚本

    #!/bin/sh # chkconfig: 2345 40 98 # description: Start/Stop Nginx server path=/application/nginx/sbi ...

  2. centos7 firefox 安装flash

    在官网下载flash的tar包 https://get.adobe.com/flashplayer/?spm=a2h0j.8191423.movie_player.5~5~5~8~A 在下载tar包的 ...

  3. poj 2367

    Genealogical tree Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 3658   Accepted: 2433 ...

  4. 第二篇: Ansible 安装

    一.配置epel源 wget –O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo 二.安装ansible  ...

  5. jQuery动态加载JS以减少服务器压力

    如果您要创建一个web2.0的应用程序,那么你的网页会包括大量的JavaScript文件,这些可能会拖慢您的网页.因此,动态加载JavaScript代码到您的网页是一个好主意,即只有当实用他们的时候加 ...

  6. vagrant系列四:vagrant搭建redis与redis的监控程序redis-stat

    上一篇php7环境的搭建 真是火爆.仅仅两天时间,就破了我之前swagger系列的一片文章,看来,大家对搭建好开发环境真是情有独钟. 为了訪问量,我今天再来一篇redis的搭建. 当然不能仅仅是red ...

  7. 在VS中自动生成NuGet包以及搭建自己的或单位内部的NuGet服务器

    关于NuGet的介绍已经很多,可以参考下面的: NuGet学习笔记(1)--初识NuGet及快速安装使用 http://kb.cnblogs.com/page/143190/ NuGet学习笔记(2) ...

  8. ios开发:如何用js调用ios

    本文转载至 :http://blog.chinaunix.net/uid-29415710-id-4058564.html - (BOOL)webView:(UIWebView *)webView s ...

  9. CAFFE学习笔记(二)Caffe_Example之测试mnist

    这一次的博客将接着上一次的内容,简单讲解一下如何使用训练后的网络lenet_iter_5000.caffemodel与lenet_iter_10000.caffemodel. 1.在网络训练完毕后,将 ...

  10. Linux c编程:I/O多路复用之select

    一般我们在写socet程序的时候调用的accept,recv等操作都是阻塞型的.意思就是如果我们一直收不到数据那么则会被阻塞.所谓阻塞方式block,顾名思义,就是进程或是线程执行到这些函数时必须等待 ...