本文转载自: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. 安全之路:Web渗透技术及实战案例解析(第2版)

    安全之路:Web渗透技术及实战案例解析(第2版)

  2. [eclipse]eclipse设置条件断点Breakpoint Properties

    1.在你要想停下的行上添加断点,在断点标记上单击右键,然后打开断点属性(Breakpoint Properties) 2.在断点属性(Breakpoint Properties)编辑对话框中勾选ena ...

  3. python2和python3的区别——持续更新

    1.在 cookbook 上看到的,python3支持 *运算符 来接收迭代变量,如: a, *b = [, , , ] python2是不支持的! 2.在 cookbook 上看到的,python3 ...

  4. js做小数运算精度问题

    当js做小数运算时存在bug,大概是因为二进制和十进制转换之间的关系. bug如图 解决方案 1.运算结果后,乘以100再除以100.网上推荐这种方法但是乘以1000再除以1000依然存在精度问题 2 ...

  5. 【Demo】Tree.js实例

    Three.js是通过对WebGL接口的封装与简化而形成的一个易用的图形库. 简单点的说法:WebGL可以看成是浏览器给我们提供的接口,在javascript中可以直接用这些API进行3D图形的绘制: ...

  6. React中使用UEditor

    一般UEditor用于表单的新建和编辑 <FormItem {...formItemLayout} label='商品详情'> {getFieldDecorator('detail', { ...

  7. Assert 类

    Assert 类 使用 true/false 命题验证单元测试中的条件. 继承层次结构     System.Object   Microsoft.VisualStudio.TestTools.Uni ...

  8. html和js实现滚动条效果

    HTML部分 <!-- 遮罩层 --> <div id="zzc" style="z-index:-1;height:100%;width: 100%; ...

  9. fatal error: openssl/evp.h: 没有那个文件或目录

    在陆佳华<嵌入式系统软硬件协同设计实战指南 第2版>一书的第13章节 编译U-boot时会遇到2个错误.原因很简单,就从一开始的错误提示着手: fatal error: openssl/e ...

  10. Facebook的工程师文化——《打造facebook》读后感

    在今年北京的QCon大会上听了facebook早期中国籍工程师王淮的演讲,受益匪浅,主题是如何打造高效能团队,主要介绍他在facebook的一些经历和管理上的经验分享.现在的他是一名天使投资人,投资的 ...