Class: Watir::Screenshot
- Inherits:
-
Object
- Object
- Watir::Screenshot
- Defined in:
- lib/watir-screenshot-stitch.rb
Instance Method Summary collapse
-
#base64_canvas ⇒ String
deprecated
Deprecated.
@param [Watir::Browser] browser
-
#base64_geckodriver ⇒ String
Employs a cutting edge feature in geckodriver version 0.24.0 to produce a Base64 encoded string of a full page screenshot.
-
#save_stitch(path, opts = {}) ⇒ Object
deprecated
Deprecated.
@param [Watir::Browser] browser
Instance Method Details
#base64_canvas ⇒ String
Deprecated.
@param [Watir::Browser] browser
Employs html2canvas to produce a Base64 encoded string of a full page screenshot.
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/watir-screenshot-stitch.rb', line 85 def base64_canvas return self.base64 if base64_capable? 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 |
#base64_geckodriver ⇒ String
Employs a cutting edge feature in geckodriver version 0.24.0 to produce a Base64 encoded string of a full page screenshot.
33 34 35 36 37 38 39 40 41 |
# File 'lib/watir-screenshot-stitch.rb', line 33 def base64_geckodriver ensure_geckodriver resource_url = build_driver_url raw = request_payload(resource_url) parse_gecko(raw) end |
#save_stitch(path, opts = {}) ⇒ Object
Deprecated.
@param [Watir::Browser] browser
Represents stitched together screenshot and writes to file.
56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/watir-screenshot-stitch.rb', line 56 def save_stitch(path, opts = {}) return @browser.screenshot.save(path) if base64_capable? = opts @path = path calculate_dimensions return self.save(@path) if (one_shot? || bug_shot?) build_canvas gather_slices stitch_together @combined_screenshot.write @path end |