Created
August 19, 2013 22:24
-
-
Save abotalov/6274926 to your computer and use it in GitHub Desktop.
Capybara: quit browser manually, see http://stackoverflow.com/q/18293303/841064
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "capybara" | |
html = DATA.read | |
app = proc { |env| [200, { "Content-Type" => "text/html" }, [html] ] } | |
class Capybara::Selenium::Driver | |
def browser | |
unless @browser | |
@browser = Selenium::WebDriver.for(options[:browser], options.reject { |key,val| SPECIAL_OPTIONS.include?(key) }) | |
end | |
@browser | |
end | |
end | |
3.times do | |
sess = Capybara::Session.new(:selenium, app) | |
sess.visit("/") | |
sess.find('.test') | |
sess.driver.browser.quit | |
end | |
__END__ | |
<!doctype html> | |
<html> | |
<body> | |
<div class="test">sdasdas</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment