配置Capybara以使用Marionette WebDriver for Firefox [英] Configure Capybara to use Marionette WebDriver for Firefox
问题描述
随着木偶取代了FirefoxDriver,我需要配置测试以运行它。
我已经下载了二进制文件,但似乎无法将Capybara驱动程序注册配置为实际使用木偶。
With Marionette replacing FirefoxDriver, I need to configure my tests to run it. I've downloaded the binary but I can't seem to get my Capybara driver registration configured to actually use Marionette.
Capybara.register_driver :selenium_firefox do |app|
capabilities = Selenium::WebDriver::Remote::Capabilities.firefox
capabilities["firefox_binary"] = 'path/to/marionette/renamed/to/wires'
Capybara::Selenium::Driver.new(app, browser: :firefox, desired_capabilities: capabilities)
end
但是当我开始测试时,就像在没有木偶的情况下尝试一样,我只是得到FF的初始页面。
When I start a test though, I just get the initial page of FF just like I would trying to run it without marionette.
推荐答案
牵线木偶被传递给Driver.new的选项-而不是期望的能力
marionette is passed an option to Driver.new - not to desired_capabilities
Capybara.register_driver :selenium_firefox do |app|
Capybara::Selenium::Driver.new(app, browser: :firefox, marionette: true)
end
还需要您下载geckodriver,将其放在路径中,并将其重命名为wire
It also requires you to have downloaded geckodriver, put it in your path and renamed it to wires
这些配置步骤的完整说明,其中包括木偶最新的可执行文件下载链接可在此处找到
A complete description of these configuration steps, including Marionette latest executables download links can be found here.
注意:水豚还不支持木偶,一些问题已在水豚中修复,一些是selenium-webdriver中的错误,而另一些只是一般性-诸如此类的事情只是停止从选择元素中选择选项-没有引发错误,只是停止工作。我认为它还没有准备好在现实世界中使用。
Note: Capybara does not yet support marionette, some things are being fixed in capybara, some are bugs in selenium-webdriver, and others are just general flakiness of it - things like it just stops selecting options from select elements - no errors thrown, just stops working. I don't think its ready for real world use yet.
这篇关于配置Capybara以使用Marionette WebDriver for Firefox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!