Module: Selenium::WebDriver::DriverExtensions::TakesScreenshot Private
- Defined in:
- lib/selenium/webdriver/common/driver_extensions/takes_screenshot.rb
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Instance Method Summary collapse
- #save_screenshot(png_path) ⇒ Object private
- #screenshot_as(format) ⇒ Object private
Instance Method Details
#save_screenshot(png_path) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
11 12 13 |
# File 'lib/selenium/webdriver/common/driver_extensions/takes_screenshot.rb', line 11 def save_screenshot(png_path) File.open(png_path, 'wb') { |f| f << screenshot_as(:png) } end |
#screenshot_as(format) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/selenium/webdriver/common/driver_extensions/takes_screenshot.rb', line 15 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 |