lib/watir-screenshot-stitch.rb
#
# Employs html2canvas to produce a Base64 encoded string
# of a full page screenshot.
#
# @example
#   browser.screenshot.base64_canvas(browser)
#   #=> '7HWJ43tZDscPleeUuPW6HhN3x+z7vU/lufmH0qNTtTum94IBWMT46evImci1vnFGT'
#
# @deprecated
#   @param [Watir::Browser] browser
#
# @return [String]
#
Employs html2canvas to produce a Base64 encoded string
of a full page screenshot.
Employs html2canvas to produce a Base64 encoded string of a full page screenshot .
def base64_canvas(browser = @browser)
      return self.base64 if base64_capable?
      deprecate_browser(browser, (__LINE__-1))
      output = nil
      return self.base64 if one_shot? || bug_shot?
      @browser.execute_script html2canvas_payload
      @browser.execute_script h2c_activator
      @browser.wait_until(timeout: MAXIMUM_SCREENSHOT_GENERATION_WAIT_TIME) {
        output = @browser.execute_script "return window.canvasImgContentDecoded;"
      }
      raise "Could not generate screenshot blob within #{MAXIMUM_SCREENSHOT_GENERATION_WAIT_TIME} seconds" unless output
      output.sub!(/^data\:image\/png\;base64,/, '')
    end
def base64_canvas ( browser = @browser ) return self . base64 if base64_capable? deprecate_browser ( browser , ( __LINE__ - 1 ) ) output = nil return self . base64 if one_shot? || bug_shot? @browser . execute_script html2canvas_payload @browser . execute_script h2c_activator @browser . wait_until ( timeout : MAXIMUM_SCREENSHOT_GENERATION_WAIT_TIME ) { output = @browser . execute_script "return window.canvasImgContentDecoded;" } raise "Could not generate screenshot blob within #{MAXIMUM_SCREENSHOT_GENERATION_WAIT_TIME} seconds" unless output output . sub! ( / ^data \: image \/ png \; base64, / , '' ) end
Employs html2canvas to produce a Base64 encoded string
of a full page screenshot.
Employs html2canvas to produce a Base64 encoded string of a full page screenshot .
None
String
browser
<not_specific>
example
browser.screenshot.base64_canvas(browser) #=> '7HWJ43tZDscPleeUuPW6HhN3x+z7vU/lufmH0qNTtTum94IBWMT46evImci1vnFGT'
browser . screenshot . base64_canvas ( browser ) # = > ' 7HWJ43tZDscPleeUuPW6HhN3x + z7vU / lufmH0qNTtTum94IBWMT46evImci1vnFGT '
deprecated
@param [Watir::Browser] browser
@param [ Watir :: Browser ] browser