Class: Watir::Screenshot

Inherits:
Object
  • Object
show all
Defined in:
lib/watir-webdriver/screenshot.rb

Instance Method Summary collapse

Constructor Details

#initialize(driver) ⇒ Screenshot

Returns a new instance of Screenshot.



5
6
7
# File 'lib/watir-webdriver/screenshot.rb', line 5

def initialize(driver)
  @driver = driver
end

Instance Method Details

#base64String

Represents screenshot as Base64 encoded string.

Returns:

  • (String)


35
36
37
# File 'lib/watir-webdriver/screenshot.rb', line 35

def base64
  @driver.screenshot_as(:base64)
end

#pngString

Represents screenshot as PNG image string.

Returns:

  • (String)


25
26
27
# File 'lib/watir-webdriver/screenshot.rb', line 25

def png
  @driver.screenshot_as(:png)
end

#save(path) ⇒ Object

Saves screenshot to given path.

Parameters:

  • path (String)


15
16
17
# File 'lib/watir-webdriver/screenshot.rb', line 15

def save(path)
  @driver.save_screenshot(path)
end