Created
March 14, 2011 15:32
-
-
Save andreastt/869317 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class OperaWatir::Screenshot | |
attr_accessor :browser, :reply | |
def initialize(parent) | |
self.browser = parent.browser | |
self.reply = driver.saveScreenshot(2, [].to_java(:string)) | |
end | |
def save(filename) | |
File.open(filename, 'w') { |f| f.write(png) } | |
end | |
def blank? | |
reply.isBlank | |
end | |
def png | |
String.from_java_bytes(reply.getPng) | |
end | |
def md5 | |
reply.getMd5 | |
end | |
private | |
def driver | |
browser.driver | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment