Implemented the most asked for feature in Capybara history
Browser switching for Selenium Just a note to all Chrome lovers: it's twice as slow as Firefox, just be aware of that.
This commit is contained in:
parent
ce2f73fde0
commit
9bd38b334c
|
@ -79,11 +79,11 @@ class Capybara::Driver::Selenium < Capybara::Driver::Base
|
|||
|
||||
end
|
||||
|
||||
attr_reader :app, :rack_server
|
||||
attr_reader :app, :rack_server, :options
|
||||
|
||||
def browser
|
||||
unless @browser
|
||||
@browser = Selenium::WebDriver.for :firefox
|
||||
@browser = Selenium::WebDriver.for(options[:browser] || :firefox)
|
||||
at_exit do
|
||||
@browser.quit
|
||||
end
|
||||
|
@ -91,8 +91,9 @@ class Capybara::Driver::Selenium < Capybara::Driver::Base
|
|||
@browser
|
||||
end
|
||||
|
||||
def initialize(app)
|
||||
def initialize(app, options={})
|
||||
@app = app
|
||||
@options = options
|
||||
@rack_server = Capybara::Server.new(@app)
|
||||
@rack_server.boot if Capybara.run_server
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue