Sha256: 8b2ebe7ca0982c3edef6c05d4add543f543c8ba0fe90bb9adf55f7328d2a44ec

Contents?: true

Size: 629 Bytes

Versions: 12

Compression:

Stored size: 629 Bytes

Contents

module Selenium
  module WebDriver
    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.getScreenshotAsBase64
          when :png
            bridge.getScreenshotAsBase64.unpack("m")[0]
          else
            raise Error::UnsupportedOperationError, "unsupported format: #{format.inspect}"
          end
        end

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

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
rainux-selenium-webdriver-0.0.17 common/src/rb/lib/selenium/webdriver/driver_extensions/takes_screenshot.rb
selenium-webdriver-0.0.17 common/src/rb/lib/selenium/webdriver/driver_extensions/takes_screenshot.rb
selenium-webdriver-0.0.16 common/src/rb/lib/selenium/webdriver/driver_extensions/takes_screenshot.rb
selenium-webdriver-0.0.15 common/src/rb/lib/selenium/webdriver/driver_extensions/takes_screenshot.rb
selenium-webdriver-0.0.14 common/src/rb/lib/selenium/webdriver/driver_extensions/takes_screenshot.rb
selenium-webdriver-0.0.13 common/src/rb/lib/selenium/webdriver/driver_extensions/takes_screenshot.rb
selenium-webdriver-0.0.12 common/src/rb/lib/selenium/webdriver/driver_extensions/takes_screenshot.rb
selenium-webdriver-0.0.11 common/src/rb/lib/selenium/webdriver/driver_extensions/takes_screenshot.rb
selenium-webdriver-0.0.10 common/src/rb/lib/selenium/webdriver/driver_extensions/takes_screenshot.rb
selenium-webdriver-0.0.9 common/src/rb/lib/selenium/webdriver/driver_extensions/takes_screenshot.rb
selenium-webdriver-0.0.8 common/src/rb/lib/selenium/webdriver/driver_extensions/takes_screenshot.rb
selenium-webdriver-0.0.7 common/src/rb/lib/selenium/webdriver/driver_extensions/takes_screenshot.rb