Class: Watir::Screenshot
- Inherits:
-
Object
- Object
- Watir::Screenshot
- Defined in:
- lib/watir/screenshot.rb
Instance Method Summary collapse
-
#base64 ⇒ String
Represents screenshot as Base64 encoded string.
-
#initialize(browser) ⇒ Screenshot
constructor
A new instance of Screenshot.
-
#png ⇒ String
Represents screenshot as PNG image string.
-
#save(path) ⇒ Object
Saves screenshot to given path.
Constructor Details
#initialize(browser) ⇒ Screenshot
Returns a new instance of Screenshot.
5 6 7 8 |
# File 'lib/watir/screenshot.rb', line 5 def initialize(browser) @browser = browser @driver = browser.wd end |
Instance Method Details
#base64 ⇒ String
Represents screenshot as Base64 encoded string.
47 48 49 |
# File 'lib/watir/screenshot.rb', line 47 def base64 @driver.screenshot_as(:base64) end |
#png ⇒ String
Represents screenshot as PNG image string.
33 34 35 |
# File 'lib/watir/screenshot.rb', line 33 def png @driver.screenshot_as(:png) end |
#save(path) ⇒ Object
Saves screenshot to given path.
19 20 21 |
# File 'lib/watir/screenshot.rb', line 19 def save(path) @driver.save_screenshot(path) end |