Sha256: 3fd8accdd8560c9335616d480c15400acbbebc3470eddcadf5994f133a2f7d9c

Contents?: true

Size: 642 Bytes

Versions: 11

Compression:

Stored size: 642 Bytes

Contents

module Selenium
  module WebDriver

    #
    # @private
    #

    module DriverExtensions
      module TakesScreenshot

        def save_screenshot(png_path)
          File.open(png_path, 'w') { |f| f << screenshot_as(:png) }
        end

        def screenshot_as(format)
          case format
          when :base64
            bridge.getScreenshot
          when :png
            bridge.getScreenshot.unpack("m")[0]
          else
            raise Error::UnsupportedOperationError, "unsupported format: #{format.inspect}"
          end
        end

      end # TakesScreenshot
    end # DriverExtensions
  end # WebDriver
end # Selenium

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
selenium-webdriver-0.0.28 lib/selenium/webdriver/driver_extensions/takes_screenshot.rb
selenium-webdriver-0.0.27 lib/selenium/webdriver/driver_extensions/takes_screenshot.rb
selenium-webdriver-0.0.26 lib/selenium/webdriver/driver_extensions/takes_screenshot.rb
selenium-webdriver-0.0.25 lib/selenium/webdriver/driver_extensions/takes_screenshot.rb
selenium-webdriver-0.0.24 common/src/rb/lib/selenium/webdriver/driver_extensions/takes_screenshot.rb
selenium-webdriver-0.0.23 common/src/rb/lib/selenium/webdriver/driver_extensions/takes_screenshot.rb
selenium-webdriver-0.0.22 common/src/rb/lib/selenium/webdriver/driver_extensions/takes_screenshot.rb
selenium-webdriver-0.0.21 common/src/rb/lib/selenium/webdriver/driver_extensions/takes_screenshot.rb
selenium-webdriver-0.0.20 common/src/rb/lib/selenium/webdriver/driver_extensions/takes_screenshot.rb
selenium-webdriver-0.0.19 common/src/rb/lib/selenium/webdriver/driver_extensions/takes_screenshot.rb
selenium-webdriver-0.0.18 common/src/rb/lib/selenium/webdriver/driver_extensions/takes_screenshot.rb