Class: Dhalang::Screenshot

Inherits:
Object
  • Object
show all
Defined in:
lib/Screenshot.rb

Overview

Allows consumers of this library to take screenshots with Puppeteer.

Class Method Summary collapse

Class Method Details

.get_from_url_as_jpeg(url, options = {}) ⇒ String

Captures a full JPEG screenshot of the webpage under the given url.

Parameters:

  • url (String)

    The url to take a screenshot of.

  • options (Hash) (defaults to: {})

    User configurable options.

Returns:

  • (String)

    the screenshot that was taken as binary.



13
14
15
# File 'lib/Screenshot.rb', line 13

def self.get_from_url_as_jpeg(url, options = {})
  get(url, "jpeg", options)
end

.get_from_url_as_png(url, options = {}) ⇒ String

Captures a full PNG screenshot of the webpage under the given url.

Parameters:

  • url (String)

    The url to take a screenshot of.

  • options (Hash) (defaults to: {})

    User configurable options.

Returns:

  • (String)

    The screenshot that was taken as binary.



23
24
25
# File 'lib/Screenshot.rb', line 23

def self.get_from_url_as_png(url, options = {})
  get(url, "png", options)
end