Sha256: 0ec8dd0c9b41d65983044191c906c5186329ff371999b2671c3a4763f54df1f3

Contents?: true

Size: 884 Bytes

Versions: 47

Compression:

Stored size: 884 Bytes

Contents

module Watir
  class Screenshot

    def initialize(driver)
      @driver = driver
    end

    #
    # Saves screenshot to given path.
    #
    # @example
    #   browser.screenshot.save "screenshot.png"
    #
    # @param [String] path
    #

    def save(path)
      @driver.save_screenshot(path)
    end

    #
    # Represents screenshot as PNG image string.
    #
    # @example
    #   browser.screenshot.png
    #   #=> '\x95\xC7\x8C@1\xC07\x1C(Edb\x15\xB2\vL'
    #
    # @return [String]
    #

    def png
      @driver.screenshot_as(:png)
    end

    #
    # Represents screenshot as Base64 encoded string.
    #
    # @example
    #   browser.screenshot.base64
    #   #=> '7HWJ43tZDscPleeUuPW6HhN3x+z7vU/lufmH0qNTtTum94IBWMT46evImci1vnFGT'
    #
    # @return [String]
    #

    def base64
      @driver.screenshot_as(:base64)
    end

  end # Screenshot
end # Watir

Version data entries

47 entries across 47 versions & 2 rubygems

Version Path
watir-6.11.0 lib/watir/screenshot.rb
watir-6.11.0.beta2 lib/watir/screenshot.rb
watir-6.11.0.beta1 lib/watir/screenshot.rb
watir-6.10.3 lib/watir/screenshot.rb
watir-6.10.2 lib/watir/screenshot.rb
watir-6.10.0 lib/watir/screenshot.rb
watir-6.9.1 lib/watir/screenshot.rb
watir-6.9.0 lib/watir/screenshot.rb
watir-6.8.4 lib/watir/screenshot.rb
watir-6.8.3 lib/watir/screenshot.rb
watir-6.8.2 lib/watir/screenshot.rb
watir-6.8.1 lib/watir/screenshot.rb
watir-6.8.0 lib/watir/screenshot.rb
watir-6.7.3 lib/watir/screenshot.rb
watir-6.7.2 lib/watir/screenshot.rb
watir-6.7.1 lib/watir/screenshot.rb
watir-6.7.0 lib/watir/screenshot.rb
watir-6.6.3 lib/watir/screenshot.rb
watir-6.6.2 lib/watir/screenshot.rb
watir-6.6.1 lib/watir/screenshot.rb