Skip to content

Instantly share code, notes, and snippets.

@abotalov
Created August 19, 2013 22:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abotalov/6274926 to your computer and use it in GitHub Desktop.
Save abotalov/6274926 to your computer and use it in GitHub Desktop.
Capybara: quit browser manually, see http://stackoverflow.com/q/18293303/841064
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