watir-webdriver black screenshots-open source projects watir/watir-webdriver
adam reed
Here’s the code I’m using to capture screenshots (Watir-Webdriver, Cucumber). I use remote Windows XP VMs for my test boxes, and have not encountered the issue using Firefox or Internet Explorer.
We did find that when you view the log with the embedded screenshot, it does not seem to work in IE – so you have to use Firefox for viewing. It’s base64, so there doesn’t seem to be a logical reason for this.
After do |scenario|
if scenario.failed?
encoded_img = @browser.driver.screenshot_as(:base64)
embed("data:image/png;base64,#{encoded_img}", 'image/png')
end #
end