本文转载自: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. [place recognition]NetVLAD: CNN architecture for weakly supervised place recognition 论文翻译及解析(转)

    https://blog.csdn.net/qq_32417287/article/details/80102466 abstract introduction method overview Dee ...

  2. Axios 使用采坑经验

    报错信息:Uncaught (in promise) DOMException: Failed to execute 'open' on 'XMLHttpRequest': Invalid URL 解 ...

  3. 《F4+2》——团队项目的原型设计与开发

      目 录 1 · 团队信息 2 · NABCD模型 3.  原型设计的工具 4 · 原型设计 5 · PSP表格 6 · 团队设计过程 7 · 原型设计心得   一 · 团 队 信 息 成 员 列 ...

  4. JavaScript--练习1--99乘法表

    JavaScript--练习1--99乘法表 一.心得 二.代码 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" &quo ...

  5. 安装pip最简单的方法

    http://blog.csdn.net/lyj_viviani/article/details/70568434

  6. Mybatis出现参数错误Parameter 'cateCode_search' not found. Available parameters are [3, 2, 1, 0, param1, param2, 5, param3, 4, param4, param5, param6]

    1.参数改为序号 2.在mybatis借口上加@Param注解

  7. 剑指 offer面试题22 栈的压入和弹出序列

    题目描述 输入两个整数序列,第一个序列表示栈的压入顺序,请判断第二个序列是否为该栈的弹出顺序.假设压入栈的所有数字均不相等.例如序列1,2,3,4,5是某栈的压入顺序,序列4,5,3,2,1是该压栈序 ...

  8. Meteor.js异步全解

    翻译来源: http://phucnguyen.info/blog/everything-you-need-to-know-about-async-meteor/ posted in Web Deve ...

  9. 005——php字符串中的处理函数(四)

    <?php /** * 字符串处理函数: * parse_url 解析URL.返回其组成部分 */ /* $url="http://www.lantianwang.com/admin/ ...

  10. 安装wamp后,127.0.0.1可以访问,localhost不能访问

    今天安装wamp后,127.0.0.1可以访问,localhost不能访问,出现 “error You don't have permission to access”的错误, 网上查了下,很多方法都 ...