本文转载自: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. SQL 触发器的缺点 坏处 弊端 哼╭(╯^╰)╮

    (自己总结,有误请不吝赐教) 1.如果触发频率高,占用内存,降低数据访问速度 2.相对不灵活,一旦触发马上执行,不能排除特殊情况 3.一定程度上打乱代码结构,相关的代码都需要特别注释,否则造成阅读和维 ...

  2. Win10累积更新KB3081424安装失败的解决方法

    我在个人的PC上多次更新KB3081424都失败了,后来按照网上给出的删除注册表残留项的方法后更新成功了(删除注册表残留项后我还执行了从微软帐户切换到本地帐户的操作,有兴趣的朋友可以试试不切换能否更新 ...

  3. 简单的spring mvc实例

    简单的springmvc实例 pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi=&qu ...

  4. Android学习必备--java工具15个

    Weka .Weka集成了数据挖掘工作的机器学习算法.这些算法可以直接应用于一个数据集上或者你可以自己编写代码来调用.Weka包括一系列的工具,如数据预处理.分类.回归.聚类.关联规则以及可视化. M ...

  5. 【Matplotlib】线设置,坐标显示范围

    改变线的颜色和线宽 参考文章: controlling line properties Line API 线有很多属性你可以设置:线宽,线型,抗锯齿等等:具体请参考matplotlib.lines.L ...

  6. bzoj1367

    题解: 左偏树模板题 维护n/2的好多课左偏树 每一次加进来一个点的时候,只有一个点 然后每次中位数比前面小的时候,那么和前面合并 代码: #include<bits/stdc++.h> ...

  7. ubuntu16.04 NVIDIA CUDA8.0 以及cuDNN安装

    下载CUDA 官网下载按照自己的实际情况进行选择,下载合适的版本. 官方安装指南 注意这里下载的是cuda8.0的runfile(local)文件. 安装CUDA 下载完成后,解压到当前目录,切换到该 ...

  8. LRY_FX_Assist(辅助EA)

    功能说明 辅助EA就是别的EA没有功能用这个EA来弥补,比如说风控设置(预付款.浮亏.加仓层数等达到多少进行操作),移动止损(包括隐藏移动止损),启动马丁加仓等.这个EA不能自己独立开单,只能辅助其它 ...

  9. resin3.1处理utf-8格式的jsp时存在的问题

    解决建议:http://cnxiaowei.iteye.com/blog/262766 /dqz/eh_sdxm/reporter/reporter_show_reportdraw_river.jsp ...

  10. 选择语句=》OO函数实现

    let a; let b; if (a==="A") { b='定向' }else if (a==='B') { b='开放' }else if(a==='C') { b='全部' ...