报错信息如下时:

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. SQL Server 快捷键备忘

    Run the sp_help system stored procedure ALT+F1 Run the sp_who system stored procedure CTRL+1 Run the ...

  2. centos 7 mini装maridb 10.1 binary版本

    注:centos的版本为:CentOS-7-x86_64-Minimal-1503-01 http://isoredirect.centos.org/centos/7/isos/x86_64/Cent ...

  3. 为模版设计师而生的Twig(上)-Twig使用指南

    原文地址:http://my.oschina.net/veekit/blog/268828 1. 概要 模板是一个简单的文本文件.它可以生成任何基于文本的格式(HTML.XML.CSV等).它不具有特 ...

  4. 学会使用notepad++

    官网地址:https://notepad-plus-plus.org/ 字体尺寸更改:ctrl+鼠标滚轮 主题:设置-语言格式设置,推荐Obsidian或者Zenburn主题,推荐Consolas 1 ...

  5. Markdown 软件

    <<github.css>> Markdown 软件 :Typora / Haroopad / Markdownpad2 Markdownpad2软件注册及下载地址 邮箱地址: ...

  6. TRIGGER_15.8.3BACKUP

    1 CREATE OR REPLACE TRIGGER "XMV502"."ADDAREA12" before insert on bd_areacl for ...

  7. http 301 和 302 的区别!

    1.什么是301转向?什么是301重定向? 301转向(或叫301重定向,301跳转)是当用户或搜索引擎向网站服务器发出浏览请求时,服务器返回的HTTP数据流中头信息(header)中的状态码的一种, ...

  8. things to analysis

    Started by timer [EnvInject] - Loading node environment variables. Building remotely on RE_DEV_BUILD ...

  9. Python IDE PyCharm的基本快捷键和配置简介

    快捷键 1.编辑(Editing)Ctrl + Space 基本的代码完成(类.方法.属性)Ctrl + Alt + Space 快速导入任意类Ctrl + Shift + Enter 语句完成Ctr ...

  10. 浏览器内核控制Meta标签

    国内的主流浏览器都是双核浏览器:基于Webkit内核用于常用网站的高速浏览.基于IE的内核用于兼容网银.旧版网站.以360的几款浏览器为例,我们优先通过Webkit内核渲染主流的网站,只有小量的网站通 ...