Save a PNG screenshot to the given path
@api public
# File lib/selenium/webdriver/common/driver_extensions/takes_screenshot.rb, line 17 def save_screenshot(png_path) File.open(png_path, 'wb') { |f| f << screenshot_as(:png) } end
Return a PNG screenshot in the given format as a string
@param [:base64, :png] format @return String screenshot
@api public
# File lib/selenium/webdriver/common/driver_extensions/takes_screenshot.rb, line 29 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
Generated with the Darkfish Rdoc Generator 2.