lib/puppeteer.rb in puppeteer-ruby-0.0.16 vs lib/puppeteer.rb in puppeteer-ruby-0.0.17
- old
+ new
@@ -1,9 +1,11 @@
require 'concurrent'
class Puppeteer; end
+require 'puppeteer/env'
+
# Custom data types.
require 'puppeteer/device'
require 'puppeteer/errors'
require 'puppeteer/viewport'
@@ -166,10 +168,14 @@
default_viewport: default_viewport,
slow_mo: slow_mo,
}.compact
browser = launcher.connect(options)
if block_given?
- yield(browser)
+ begin
+ yield(browser)
+ ensure
+ browser.disconnect
+ end
else
browser
end
end