打算学习用selenium + phantomJS爬取淘女郎页面照片。

一. 先安装lxml模块

python默认的解析器是html.parser,但lxml解析器更加强大,速度更快

1. 执行 pip install virtualenv

2. 从官方网站下载与系统,Python版本匹配的lxml文件

http://pypi.python.org/pypi/lxml/2.3/

3. 执行 easy_install lxml-2.3-py2.7-win-amd64.egg

二. 安装selenium

pip install selenium

三. 使用selenium写个代码,体验一下,却出现报错

 from selenium import webdriver

 browser = webdriver.Chrome()
 browser.get('http://www.baidu.com')

运行一下,出现报错

原因是没有安装chrome浏览器的chromedriver(浏览器驱动),好了直接下载chromedriver.exe,把它放到chrome的安装目录下...\Google\Chrome\Application\ ,并配置环境变量,再次运行,又出现问题了:

原因:这是chrome浏览器版本和chromedriver版本不对应引起的,需要先查看chrome版本(可以在浏览器输入:chrome://help),我的版本是59:

再查看chrome浏览器与chromedriver的对应表,这里这个博客selenium之 chromedriver与chrome版本映射表(更新至v2.31),列出版本映射表:

我的版本59对应的chromedriver的版本是2.3.0或2.3.1,从http://chromedriver.storage.googleapis.com/index.html下载2.3.0,得以成功运行:

注:

可以去官网地址查看每个chromedriver版本对应的chrome浏览器版本:https://sites.google.com/a/chromium.org/chromedriver/downloads

下载地址:https://chromedriver.storage.googleapis.com/index.html

解决:WebDriverException: 'chromedriver' executable needs to be in PATH的更多相关文章

  1. 解决:'chromedriver' executable needs to be in PATH的问题

    0.前言 今天写一个B站登录的模拟器时,用到了Chrome浏览器,但是会报了一个异常"'chromedriver' executable needs to be in PATH", ...

  2. (续篇)Selenium 安装配置以及如何解决('chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/ch)或者(unknown error:cannot find Chrome binary)问题?

    注:本帖针对小小白哦~~(づ ̄3 ̄)づ╭- 接pip安装的帖子,不需要的直接跳过... 首先上图,出现如下的错误,那你可是找到知己了: 或者: 抱歉抱歉,这图截的不太清晰,凑合着用吧,但是也能看出来错 ...

  3. 解决selenium.common.exception.WebDriverException:Message:'chromedriver' executable needs to be in Path

    'chromedriver' executable needs to be in Path 声明:本人萌新,刚学python不久记录一下自己的坑,发出来若能帮助到一些人尽早解决问题那便是极好的,( ̄▽ ...

  4. selenium使用遇到的问题(selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH.)

    1.安装pip3 install selenium 2.使用browser=webdriver.Chrome()时报错 :selenium.common.exceptions.WebDriverExc ...

  5. python+selenium,打开浏览器时报selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH

    有一年多没写web自动化了,今天搭建环境的时候报了一个常见错误,但是处理过程有点闹心,报错就是常见的找不到驱动<selenium.common.exceptions.WebDriverExcep ...

  6. 关于 'chromedriver' executable needs to be in PATH 的解决办法

    用 chrome 浏览器跑 selenium,执行以下脚本: from selenium import webdriverdr=webdriver.Chrome()dr.maximize_window ...

  7. mac-webui-selenium下的webdriver selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH

    from selenium import webdriver def test1(): url='http://www.baidu.com' driver=webdriver.Chrome(" ...

  8. 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 下载后拷贝到 ...

  9. Chromedriver executable needs to be in path 解决办法

    执行webdriver.Chrome()时报错:Chromedriver executable needs to be in path. 原因可能是为有安装Chromedriver 可能是Chrome ...

随机推荐

  1. What are DESC and ASC Keywords?

    What are DESC and ASC Keywords? ASC is the short form for ascending DESC is the short form for desce ...

  2. 0607pm克隆&引用类&加载类&面向对象串讲&函数重载

    克隆class Ren{ public $name; public $sex; function __construct($n,$s) { $this->name=$n; $this->s ...

  3. 每天一个Linux命令(47)route命令

        Linux系统的route命令用于显示和操作内核IP路由表(show / manipulate the IP routing table).     (1)用法:     用法:  route ...

  4. JAVA 判断对象内容是否含有空值

    简单判断对象是否含有NULL值,以及信息描述. package com.sicdt.sicsign.bill.api.util; import java.lang.reflect.Invocation ...

  5. nodejs异步调用async

    犹豫nodejs是异步编程模型,有一些在同步编程中很容易做到的事情,现在却变得很麻烦,async的流程控制就是为了简化这些操作var async = require('async'); 1.serie ...

  6. pagination结合ajax

    function getContent(page,Id){ $.ajax({ type:'get', url:'www.baidu.com', dataType:'jsonp', data:{ }, ...

  7. python:格式化输出 str.format()

    官网说明:https://docs.python.org/2/library/string.html#formatstrings python的格式输出有两种方法: 1.“ %s”.(variant) ...

  8. INSPIRED启示录 读书笔记 - 第6章 招聘产品经理

    产品经理应有的特质 个人素质和态度:技术可以学习,素质却难以培养,有些素质是成功的产品经理必不可少的 对产品的热情:对产品有一种本能的热爱,是夜以继日克服困难.完善产品的动力 用户立场:能换位思考,能 ...

  9. 高通Android display分析【转】

    本文转载自:http://blog.csdn.net/zhangchiytu/article/details/6777039 高通7系列硬件架构分析 如上图,高通7系列 Display的硬件部分主要由 ...

  10. javax.mail.MessagingException: Could not connect to SMTP host: smtp.xdf.cn

    1.问题描述:关于使用Java Mail进行邮件发送,抛出Could not connect to SMTP host: xx@xxx.com, port: 25的异常可能: 当我们使用Java Ma ...