首页 > 编程语言 > 详细

mac os+selenium2+Firefox驱动+python3

时间:2017-06-26 23:17:35      阅读:181      评论:0      收藏:0      [点我收藏+]

此文章建立在之前写的chrome+selenium+Python环境配置的基础上,链接http://blog.csdn.net/zxy987872674/article/details/53082896 
之前写selenium脚本,都用的chrome浏览器,看很多人说Firefox不需要额外安装驱动来适配selenium,以为可以直接运行,但是今天安装Selenium IDE环境时,想用下Firefox浏览器,就写了段脚本测试一下:

from selenium import webdriver
import time

driver = webdriver.Firefox()
driver.get("http://www.baidu.com")
time.sleep(3)
driver.quit()

结果提示:

WebDriverException: Message: ‘geckodriver‘ executable needs to be in PATH. 

参考chrome环境安装过程,进入官网: 
http://docs.seleniumhq.org/download/选择对应系统的浏览器驱动,我下载的是geckodriver-v0.11.1-macos.tar.gz,将解压后的geckodriver移动到/usr/local/bin目录下,重新运行脚本;

    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: Missing ‘marionetteProtocol‘ field in handshake

 

具体报错原因不详,将本机的Firefox升级到Firefox 49.0.2,重新运行脚本,可以正常运行。

mac os+selenium2+Firefox驱动+python3

原文:http://www.cnblogs.com/xqnq2007/p/7082862.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!