Module: Ferrum::Page::Screenshot

Included in:
Ferrum::Page
Defined in:
lib/ferrum/page/screenshot.rb

Instance Method Summary collapse

Instance Method Details

#pdf(**opts) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/ferrum/page/screenshot.rb', line 14

def pdf(**opts)
  path, encoding = common_options(**opts)
  options = pdf_options(**opts)
  data = command("Page.printToPDF", **options).fetch("data")
  return data if encoding == :base64
  save_file(path, data)
end

#screenshot(**opts) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/ferrum/page/screenshot.rb', line 6

def screenshot(**opts)
  path, encoding = common_options(**opts)
  options = screenshot_options(path, **opts)
  data = command("Page.captureScreenshot", **options).fetch("data")
  return data if encoding == :base64
  save_file(path, data)
end