本文转载自:http://blog.csdn.net/sinat_36764186/article/details/55520444

网上的某测试代码:

from selenium import webdriver
driver = webdriver.PhantomJS(executable_path="C:\Python27\Scripts\phantomjs-2.1.1-windows\bin\phantomjs.exe")
driver.get("http://www.baidu.com")
data = driver.title
print data

配置环境变量path

C:\Python27\Scripts\phantomjs-2.1.1-windows\bin 

无效(此处发现有人的错误是路径一直写到了xxx.exe

检查源程序

发现自己原来把Scripts打成了Script

路径请复制不要手打!

仍有错

最终

Windows环境下完整路径前加r!!!

executable_path=r"C:\Python27\Scripts\phantomjs-2.1.1-windows\bin\phantomjs.exe"

解决

WebDriverException: Message: 'phantomjs.exe' executable needs to be in PATH.的更多相关文章

  1. 'phantomjs.exe' executable needs to be in PATH. (selenium PhantomJS python)

    今天selenium PhantomJS python用了下,发现报错,提示我:'phantomjs.exe' executable needs to be in PATH. from seleniu ...

  2. selenium.common.exceptions.WebDriverException: Message: 'phantomjs' executab

    该问题博主是在Mac环境遇到的,对应windows找对应解决方案解决即可. 问题原因: phantomjs环境配置有问题,要么是配置错误,要么是没有配置. 解决方案: 1.将下载解压好的phantom ...

  3. Python ——selenium报错 'chromedriver.exe' executable needs to be in PATH

    from selenium import webdriver dr = webdriver.Chrome() 运行时报错: 问题分析: 1.没有下载chromedriver.exe 2.chromed ...

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

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

  6. windows下使用selenium报错selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH

    问题 :执行程序代码报错: WebDriverException:Message:'geckodriver'executable needs to be in Path 或者 selenium.com ...

  7. selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH. 错误处理方法

    首次使用selenium webdriver,webdriver.Firefox() 报错selenium.common.exceptions.WebDriverException: Message: ...

  8. selenium使用报错“selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH.”

    安装了python3,使用pip安装了selenium,但是在使用时,报了“selenium.common.exceptions.WebDriverException: Message: 'gecko ...

  9. Selenium安装失败WebDriverException: Message: 'gechodriver' executable needs to be in PATH

    在搭建Python+Selenium自动化测试时,用python通过WebDriver驱动Firefox浏览器时,一直无法执行测试用例. 报错信息:WebDriverException: Messag ...

随机推荐

  1. ubuntu 18.04 64bit build tensorflow report error:C++ compilation of rule '//tensorflow/core/kernels:broadcast_to_op' failed (Exit 4)

    注意:笔者未能在Ubuntu18.04 64bit下成功从源码编译cpu版本的tensorflow Ans: 1.You are likely running out of memory. Try r ...

  2. Knockout 监控数组对象属性

    代码: function Product(ProductID,ProductName,ProductNum,Result,Price) { this.ProductID = ko.observable ...

  3. mysql插入中文数据报错 java.sql.SQLException: Incorrect string value: '\xE5\x90\x88\xE8\xAE\xA1' for column

    1.我们创建数据库的时候没有更改数据库的字符集为utf8. 在mysql工具中,右击数据库,->"改变数据库",->选择“基字符集”为utf-8; 2,数据库中表的字符 ...

  4. Linux vi编辑器的使用

    vi是Visual Interface的简称,它是Linux/Unix下的文本编辑器,例如你想编辑文件english.txt,则你可以在终端下输入 vi english.txt命令,然后就进入了编辑界 ...

  5. JavaScript---详解cookie

    1.什么是cookie? 在讨论cookie之前,需要知道“会话跟踪”这个概念. 1. 什么是会话  客户端打开与服务器的连接发出请求到服务器响应客户端请求的全过程称之为会话 2. 什么是会话跟踪  ...

  6. CF 274D Lovely Matrix 拓扑排序,缩点 难度:2

    http://codeforces.com/problemset/problem/274/D 这道题解题思路: 对每一行统计,以小值列作为弧尾,大值列作为弧头,(-1除外,不连弧),对得到的图做拓扑排 ...

  7. sgu 142. Keyword 暴力,hash 难度:0

    142. Keyword time limit per test: 0.5 sec. memory limit per test: 16384 KB Kevin has invented a new ...

  8. Transaction ACID (转载)

    Transaction 原文出处: 黄勇    Transaction 也就是所谓的事务了,通俗理解就是一件事情.从小,父母就教育我们,做事情要有始有终,不能半途而废.�0�2事务也是这样,不能做一般 ...

  9. 认识 ARM、FPGA

    0. ARM ARM:Advanced RISC machine,微处理行业的一家知名企业.适用于多种领域,如嵌入控制,消费.教育类多媒体.DSP和移动式应用. 优势: 功耗低,不容易发热.死机: 3 ...

  10. iOS-----MFMessageCompose 和 MFMailComposeViewController的使用方法

    MFMessageCompose 和 MFMailComposeViewController的使用方法 使用MFMessageComposeViewCOntroller发短信 应用想自己提供界面让用户 ...