Class: SugoiWebpageCapture::Screenshot
- Inherits:
-
Object
- Object
- SugoiWebpageCapture::Screenshot
- Includes:
- Capybara::DSL
- Defined in:
- lib/sugoi_webpage_capture/screenshot.rb
Instance Method Summary collapse
- #capture(captured_url) {|_self| ... } ⇒ Object
-
#initialize(browser: :firefox) ⇒ Screenshot
constructor
A new instance of Screenshot.
Constructor Details
#initialize(browser: :firefox) ⇒ Screenshot
Returns a new instance of Screenshot.
5 6 7 |
# File 'lib/sugoi_webpage_capture/screenshot.rb', line 5 def initialize(browser: :firefox) SugoiWebpageCapture.init(browser) end |
Instance Method Details
#capture(captured_url) {|_self| ... } ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/sugoi_webpage_capture/screenshot.rb', line 9 def capture(captured_url) page.current_window.resize_to(1024, 768) tempfile = Tempfile.new(["ss", ".png"]) visit captured_url yield(self) if block_given? # TODO Chtome full size capture page.driver.save_screenshot(tempfile, full: true) tempfile end |