报错信息如下时:

selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH.

这是因为在Firefox高版本需要使用 geckodriver 来驱动,不再使用Seleniu默认自带的Firefox webdriver。

我们只需要在下面这个地址下载 geckodriver 并将 其所在的路径设为环境变量即可解决。

https://github.com/mozilla/geckodriver/releases

当报如下错误信息时,则是

selenium.common.exceptions.WebDriverException: Message: Expected browser binary location, but unable to find binary in default location,
no 'moz:firefoxOptions.binary' capability provided, and no binary flag set on the command line

这时我们需要指定Firefox浏览器程序路径。

binary = FirefoxBinary('D:\\Firefox\\Firefox\\firefox.exe')
driver = webdriver.Firefox(firefox_binary=binary)

注:提示找不到"firefoxBinary"可以通过下面语句导入    from selenium.webdriver.firefox.firefox_binary import FirefoxBinary

这样就能正常使用了。

另一个处理办法是将firefox的安装路径,直接增加到 python35\Lib\site-packages\selenium\webdriver\firefox 目录下的 firefox_binary.py文件中,如下图所示,然后driver = webdriver.Firefox()调用

selenium3.0.1调用firefox的更多相关文章

  1. selenium3.0不兼容火狐的解决方案

    当直接调用火狐出现不兼容错误时,如何解决? 详看Message中提示:Expected browser binary location,but unable to find binary in def ...

  2. Selenium3.0 自动化测试

    早在2013年的时候,Selenium官方宣布,Selenium新的版本会在圣诞节的时候发布.但是,他们并没有说哪一个圣诞节发布. 转眼的三年过去了,目前已经发布到Selenium3.0 beta4版 ...

  3. 『心善渊』Selenium3.0基础 — 1、Selenium自动化测试框架介绍

    目录 1.Selenium介绍 2.Selenium的特点 3.Selenium版本说明 4.拓展:WebDriver与Selenium RC的区别 5.Webdriver工作原理 1.Seleniu ...

  4. 1 selenium3.0.1无法打开火狐浏览器

    [问题描述] 1.配置selenium3.0和java后,尝试打开火狐浏览器,提示缺少geckodriver驱动. [解决方案] 1.在http://www.seleniumhq.org/downlo ...

  5. Selenium2+python自动化2-pip降级selenium3.0

    selenium版本安装后启动Firefox出现异常:'geckodriver' executable needs to be in PATH selenium默默的升级到了3.0,然而网上的教程都是 ...

  6. Selenium+Python浏览器调用:Firefox

    如何查看python selenium的API python -m pydoc -p  4567 说明: python -m pydoc表示打开pydoc模块,pydoc是查看python文档的首选工 ...

  7. 1.2 pip降级selenium3.0

    1.2 pip降级selenium3.0 selenium版本安装后启动Firefox出现异常:'geckodriver' executable needs to be in PATHselenium ...

  8. 【基础】火狐和谷歌在Selenium3.0上的启动(二)

    参考地址:http://www.cnblogs.com/fnng/p/5932224.html https://github.com/mozilla/geckodriver [火狐浏览器] 火狐浏览器 ...

  9. Selenium2学习(一)-pip降级selenium3.0

    selenium版本安装后启动Firefox出现异常:'geckodriver' executable needs to be in PATH selenium默默的升级到了3.0,然而网上的教程都是 ...

随机推荐

  1. JSBinding+Bridge.Net:框架代码与逻辑代码的关系

    在JSB+Bridge工程中你可以同时维护Cs版本和Js版本的游戏. 框架代码:简称framework,表示那些不进行热更的代码.注意,这包括你自己写的代码,也包括引用的Dll,比如UnityEngi ...

  2. winform中button的image属性无法更改

    在开发一个winform程序的时候,界面中的button的image本来有一个贴图A.后来我觉得不合适,打算换成贴图B. 但是这时问题出现了:虽然我改成了贴图B,在IDE中的预览也是贴图B,但是每次编 ...

  3. memcache原理、简单使用、分布式实现方案

    原理:http://www.cnblogs.com/chy2055/p/5127499.html 使用教程:http://www.travisup.com/post/index/21 memcache ...

  4. Unity中Instantiate一个prefab时需要注意的问题

    在调用Instantiate()方法使用prefab创建对象时,接收Instantiate()方法返回值的变量类型必须和声明prefab变量的类型一致,否则接收变量的值会为null.   比如说,我在 ...

  5. 创建COM对象时遭遇 800702e4

    SolidEdge st5(x64) SDK /vs2012/win8.1 x64 西夏普创建SEApplication COM对象时遭遇800702e4.翻来覆去的调vs进程的权限,调se进程的权限 ...

  6. Registry values for ProductID and LocaleID for AutoCAD and the vertical products

    原文地址:http://adndevblog.typepad.com/autocad/2013/08/registry-values-for-productid-and-localeid-for-au ...

  7. SQL Server中字符串函数LEN 和 DATALENGTH辨析

    LEN:返回指定字符串表达式的字符(而不是字节)数,其中不包含尾随空格. DATALENGTH:返回用于表示任何表达式的字节数. 示例1:(相同,返回结果都为5): select LEN ('ssss ...

  8. Svg path画线(不管是直线还是曲线)在一定情况下线条的宽度不一的情况(记录)

    在项目中涉及到svg: 使用path划线实现图表功能. 记录在实现的过程中发现的问题:path在小像素的情况下画出的线条宽度不一样.这是为什么呢? 以下是我做的猜想: 可以看图 在宽度给的很足的时候没 ...

  9. C#:优惠券代码

    static Random random = new Random(); List<string> generatedVouchers = new List<string>() ...

  10. 测试 ClownFish、CYQ、Entity Framework、Moon、MySoft、NHibernate、PDF、XCode数据访问组件性能

    下期预告: 由于很多园友反馈,有的组件不应该缺席.测试复杂度不够.测试还缺乏一定的公平. 因此考虑在下一个版本中,确保在更加公平的前提下进行更高复杂度的测试 . 同时将分为2组测试,纯SQL组件及纯O ...