Updated README to make driver registration and configuration more clear.
This commit is contained in:
parent
5e1d159adf
commit
1edd6e5da9
12
README.md
12
README.md
|
@ -271,7 +271,7 @@ RackTest can be configured with a set of headers like this:
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
Capybara.register_driver :rack_test do |app|
|
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
|
end
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -794,7 +794,7 @@ end
|
||||||
|
|
||||||
Capybara makes it convenient to switch between different drivers. It also exposes
|
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
|
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
|
```ruby
|
||||||
Capybara.register_driver :selenium do |app|
|
Capybara.register_driver :selenium do |app|
|
||||||
|
@ -802,8 +802,7 @@ Capybara.register_driver :selenium do |app|
|
||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
|
||||||
However, it's also possible to give this a different name, so tests can switch
|
However, it's also possible to give this configuration a different name.
|
||||||
between using different browsers effortlessly:
|
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
Capybara.register_driver :selenium_chrome do |app|
|
Capybara.register_driver :selenium_chrome do |app|
|
||||||
|
@ -811,6 +810,11 @@ Capybara.register_driver :selenium_chrome do |app|
|
||||||
end
|
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
|
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.
|
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.
|
Gems can use this API to add their own drivers to Capybara.
|
||||||
|
|
Loading…
Reference in New Issue