Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Updated README to make driver registration and configuration more clear.

  • Loading branch information...
commit 1edd6e5da9f41d02b1944149851b25ec4e64c210 1 parent 5e1d159
Evan Prothro eprothro authored
Showing with 8 additions and 4 deletions.
  1. +8 −4 README.md
12 README.md
View
@@ -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
```
@@ -794,7 +794,7 @@ 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|
@@ -802,8 +802,7 @@ Capybara.register_driver :selenium do |app|
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|
@@ -811,6 +810,11 @@ Capybara.register_driver :selenium_chrome do |app|
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.
Please sign in to comment.
Something went wrong with that request. Please try again.