打算学习用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. Python3 面向对象(1)

    面向.概述 面向过程: 根据业务逻辑从上到下写垒代码面向过程的设计的核心是过程,过程即解决问题的步骤, 面向过程的设计就好比精心设计好一条流水线,考虑周全什么时候处理什么东西 优点: 极大降低了程序的 ...

  2. PAT 1068. 万绿丛中一点红(20)

    对于计算机而言,颜色不过是像素点对应的一个24位的数值.现给定一幅分辨率为MxN的画,要求你找出万绿丛中的一点红,即有独一无二颜色的那个像素点,并且该点的颜色与其周围8个相邻像素的颜色差充分大. 输入 ...

  3. 启动hive --service metastore &出现Missing Hive Execution Jar: /opt/apache-hive-1.2.0-bin//lib/hive-exec-*.jar

    原因:出现上述问题通常是运行hive 在bin/目录下的脚本所致. 解决办法:就是让HIVE_HOME变量指向hive-trunk/build/dist目录,将$HIVE_HOME/bin添加到PAT ...

  4. 测试开发面试的Linux面试题:常用命令

    Hello,大家好上次给大家介绍了vim使用方法,今天来给大家讲一讲linux系统文件命令 (1)Linux的文件系统目录配置要遵循FHS规范,规范定义的两级目录规范如下:        /home  ...

  5. (转)fiddler使用简介--其二

    原文地址:http://www.cnblogs.com/miantest/p/7290176.html 在上一篇中介绍了Fiddler的基本使用方法.通过上一篇的操作我们可以直接抓取浏览器的数据包.但 ...

  6. 【Zookeeper】初识zookeeper

    单机模式 安装并解压: 修改配置文件,conf/zoo.cfg(配置完成后,启动后,可以通过netstat-ano命令查看是否有你配置的clientPort端口号在监听服务) tickTime: zo ...

  7. Django基础(二)_Ajax、csrf伪站请求

    什么是json? 定义: JSON(JavaScript Object Notation, JS 对象标记) 是一种轻量级的数据交换格式.它基于 ECMAScript (w3c制定的js规范)的一个子 ...

  8. dom树改变监听

    function unwrap(el, target) { if ( !target ) { target = el.parentNode; } while (el.firstChild) { tar ...

  9. Loadrunder之脚本篇——检查点

    VuGen判断脚本是否执行成功是根据服务器返回的状态来确定的,如果服务器返回的是HTTP状态为200 OK,那么VuGen就认为脚本正确地运行了,并且是运行通过的.而大多数系统出错时是不会返回错误页面 ...

  10. b和strong,i与em的区别

    html语义化标签: 1)title与h1的区别 title与H1是不能划等号的 1.H1是大标题的意思.一般出现网页文章页面,作用如同一张报纸的大标题,使用读者在没看内容之前就 大概了解本文的旨意, ...