Skip to content

Commit

Permalink
Updated README to make driver registration and configuration more clear.
Browse files Browse the repository at this point in the history
  • Loading branch information
eprothro committed Sep 4, 2013
1 parent 5e1d159 commit 1edd6e5
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ RackTest can be configured with a set of headers like this:

```ruby
Capybara.register_driver :rack_test do |app|
Capybara::RackTest::Driver.new(app, :headers => { 'User-Agent' => 'Capybara' })
Capybara::RackTest::Driver.new(app, :headers => { 'HTTP_USER_AGENT' => 'Capybara' })
end
```

Expand Down Expand Up @@ -794,23 +794,27 @@ end

Capybara makes it convenient to switch between different drivers. It also exposes
an API to tweak those drivers with whatever settings you want, or to add your own
drivers. This is how to switch the selenium driver to use chrome:
drivers. This is how to override the selenium driver configuration to use chrome:

```ruby
Capybara.register_driver :selenium do |app|
Capybara::Selenium::Driver.new(app, :browser => :chrome)
end
```

However, it's also possible to give this a different name, so tests can switch
between using different browsers effortlessly:
However, it's also possible to give this configuration a different name.

```ruby
Capybara.register_driver :selenium_chrome do |app|
Capybara::Selenium::Driver.new(app, :browser => :chrome)
end
```

Then tests can switch between using different browsers effortlessly:
```ruby
Capybara.current_driver = :selenium_chrome
```

Whatever is returned from the block should conform to the API described by
Capybara::Driver::Base, it does not however have to inherit from this class.
Gems can use this API to add their own drivers to Capybara.
Expand Down

0 comments on commit 1edd6e5

Please sign in to comment.