Skip to content

Instantly share code, notes, and snippets.

@deepti-kakade
Last active December 18, 2015 16:29
we need gem cucumber-rails it will automatically install Capybara,selinium-driver,database-cleaner
Drivers
Capybara uses the same DSL to drive a variety of browser and headless drivers.
Selecting the Driver
By default, Capybara uses the :rack_test driver, which is fast but limited: it does not support JavaScript, nor is it able to access HTTP resources outside of your Rack application, such as remote APIs and OAuth services. To get around these limitations, you can set up a different default driver for your features. For example if you'd prefer to run everything in Selenium, you could do:
Capybara.default_driver = :selenium
However, if you are using RSpec or Cucumber, you may instead want to consider leaving the faster :rack_test as the default_driver, and marking only those tests that require a JavaScript-capable driver using :js => true or @javascript, respectively. By default, JavaScript tests are run using the :selenium driver. You can change this by setting Capybara.javascript_driver.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment