views:

442

answers:

2

I'm executing selenium tests with testng, that are started on a remote system with Selenium RC via hudson (with ssh connection). The remote system is windows xp with MKS Toolkit installed, hence ssh. Tests are NOT executed as a windows service.

I've tried using both captureScreenshot and captureEntirePageScreenshot methods. The first one always produces a black image. The second one creates the correct screen shot but it only works on Firefox and our tests usually pass on Firefox and fail in other browsers, so it is crucial to capture screen shots for the other browsers (mainly IE and Safari). The tests are ran in parallel, with many browser windows open at the same time. I'm not certain if this is what's causing the problem. Any thoughts will be appreciated.

+1  A: 

Unfortunately screenshots in Selenium have been problematic from the start in browsers that are not Firefox. This is something that we Selenium Developers have been working on for a while to correct.

The latest work has been updating Snapsie to work in IE. There is a blog post at http://blog.codecentric.de/en/2010/02/remote-screenshots-mit-selenium-und-dem-robot-framework/ that explains what has happened.

I have noticed that if the screen isn't active, i.e. the screensaver has kicked in, it can produce black screenshots.

Edit:

I just had a thought. You can always run Castro to video record your tests and then watch it play back. This is something SauceLabs use to run Selenium in the cloud.

AutomatedTester
Thank you for the pointers. Looks like there is no solution for taking screen shots with non firefox browsers in an automated execution (when user is not actively logged in). That's not good.I'll check out castro...
Lidia
Hmmm... Castro is a python library. We do not use python. Our tests are written in java (testng).
Lidia
you could call into it using jython (Java's Implementation of Python). I have only ever used IronPython (i'm .NET and got it to work)
AutomatedTester
A: 

Write a method for this and call that whereever you need to take the screenshot. Use the java.awt package which has been used in selenium. For example, check this site

Rajasankar