bin/support/ruby/lib/commands/exercise/instructions.rb
# Captures and saves screenshots.
# Useful for adding images to your templates.
# @example
#   In ERB template:
#   ![Screenshot](<%= capture('http://the.url.com', 'filename.png') %>)
# @param [String] url the url to take a screenshot of.
# @param [String] filename the filename to save the screenshot to.
# @return [String] The filename of the saved screenshot
Captures and saves screenshots.
Useful for adding images to your templates.
Captures and saves screenshots . Useful for adding images to your templates .
def capture(url, filename)
      page_class = Class.new { include PageMagic }
      session = PageMagic.session(browser: :headless_chrome, url: url)
      session.visit(page_class, url: url)
      session.browser.save_screenshot(filename)
      filename
    end
def capture ( url , filename ) page_class = Class . new { include PageMagic } session = PageMagic . session ( browser : :headless_chrome , url : url ) session . visit ( page_class , url : url ) session . browser . save_screenshot ( filename ) filename end
Captures and saves screenshots.
Captures and saves screenshots .
The filename of the saved screenshot
The filename of the saved screenshot
String
url
<not_specific>
filename
<not_specific>
<not_specific>
filename the filename to save the screenshot to.
filename the filename to save the screenshot to .
example
None