Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

watir-webdriver black screenshots

I'm using watir-webdriver to navigate around my website and grab screenshots in different browsers.

Sometimes the screenshots taken in IE turn out the right size, but colored entirely black. The firefox tests that get run at the same time look fine.

browser.driver.save_screenshot(screenshot_dir)

Once I remote desktop to the computer running the tests the IE screenshots look okay again. A little bit after leaving remote desktop the IE screenshots go black again.

I'm running these tests on a instance of Windows Server running on ec2.

like image 566
will Avatar asked Nov 01 '11 17:11

will


2 Answers

Based on your comment that remotely accessing the machine resolves the problem for a little while... disable the screensaver on that box. I'm not sure how (if at all) the screenshot functions on IE and FF differ, but it's worth the time it would take to test the change.

Edit: I still feel like it's windows/power setting related as you logging into the box appears to have an effect, but I don't know what else specifically that could be. I tried a programmatic approach below vvv.

like image 120
adam reed Avatar answered Oct 11 '22 15:10

adam reed


From what you are saying, it sounds like the Windows system is automatically locking, like it should. This would explain why screenshots work fine when you remote in, and then go to black several minutes later when the screensaver kicks in and locks your system.

If the Windows system is locked, screenshots are blacked out. This is a Windows security feature.

I would be curious to know if FF really does do screen captures on a locked system.

like image 45
Jason McI Avatar answered Oct 11 '22 14:10

Jason McI