Search code examples
seleniumcapybaraselenium-firefoxdriverfirefox-marionette

Configure Capybara to use Marionette WebDriver for Firefox


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

When I start a test though, I just get the initial page of FF just like I would trying to run it without marionette.


Solution

  • 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
    

    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.

    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.