【问题标题】:How to use selenium capabilities for Firefox in splinter?如何在 splinter 中为 Firefox 使用 selenium 功能?
【发布时间】:2016-06-15 00:51:25
【问题描述】:

我正在使用基于 selenium 构建的 python splinter,我想为 firefox 使用另一个 webdriver,因为从版本 47 开始,firefox 按照以下链接更改了 webdriver

https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette/WebDriver

splinter docs 说您可以传递功能参数来使用硒功能

from splinter import Browser 
browser = Browser(‘firefox’, capabilities={‘acceptSslCerts’: True})

http://splinter.readthedocs.io/en/master/drivers/firefox.html#how-to-use-selenium-capabilities-for-firefox

但是在使用测试时我得到了错误

TypeError: init() 得到了一个意外的关键字参数 'capabilities'

splinter.driver.webdriver.firefox.WebDriver 类也不包含功能,虽然在 splinter doc 中包含它,但我有最新版本,我错过了什么?!

__init__(self, profile=None, extensions=None, user_agent=None, profile_preferences=None, fullscreen=False, wait_time=2)

【问题讨论】:

    标签: python selenium webdriver splinter


    【解决方案1】:

    您正在查看为splinter 项目的master 分支 生成的文档。

    要使capabilities 工作,您需要卸载splinter 并安装它directly from github

    $ pip uninstall splinter
    $ pip install git+https://github.com/cobrateam/splinter#master
    

    (为我工作)。

    【讨论】:

    • 这解决了问题,谢谢,请您解释一下什么是主版本?
    • @Amr 在这种情况下,这是一个 git 分支,它“代表”包的开发版本..
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-03-09
    • 2012-12-27
    • 1970-01-01
    • 1970-01-01
    • 2021-05-10
    • 1970-01-01
    相关资源
    最近更新 更多