Sha256: d66f2531e8b382d065ed6bc9a25a360811a0ba756c20e549397300c352f469a9
Contents?: true
Size: 1.49 KB
Versions: 3
Compression:
Stored size: 1.49 KB
Contents
# Capybara [Capybara](https://github.com/teamcapybara/capybara) is originally a test framework for web applications. When Capybara is in use, a remote browser process is available as a Capybara session: ```ruby Wayfarer.config.network.agent = :capybara # Wayfarer.config.capybara.driver = ... class DummyJob < Wayfarer::Worker route { to :index } def index browser # => #<Capybara::Session ...> end end ``` ## Configuring a driver 1. Install the Capybara driver for the desired user agent. For example, to automate Google Chrome with [Ferrum](https://github.com/rubycdp/ferrum), install the [Cuprite](https://github.com/rubycdp/cuprite) driver: === "RubyGems" ```ruby gem install cuprite ``` === "Bundler" ```ruby gem "cuprite" # Gemfile ``` 2. Configure Wayfarer to use the `:capybara` user agent and set the desired driver: === "Runtime" ```ruby Wayfarer.config.network.agent = :capybara Wayfarer.config.capybara.driver = :cuprite ``` === "Environment variables" ```ruby WAYFARER_NETWORK_AGENT=capybara WAYFARER_CAPYBARA_DRIVER=cuprite ``` 3. Register the driver: ```ruby require "capybara/cuprite" Capybara.javascript_driver = :cuprite Capybara.register_driver(:cuprite) do |app| # Wayfarer's Ferrum or Selenium options can be passed along Capybara::Cuprite::Driver.new(app, Wayfarer.config.ferrum.options) end ```
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
wayfarer-0.4.6 | docs/guides/networking/capybara.md |
wayfarer-0.4.5 | docs/guides/networking/capybara.md |
wayfarer-0.4.4 | docs/guides/networking/capybara.md |