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.

Lidia
  • 21
  • 1
  • 2

3 Answers3

2

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
  • 22,188
  • 7
  • 49
  • 62
  • 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 Mar 03 '10 at 01:12
  • Hmmm... Castro is a python library. We do not use python. Our tests are written in java (testng). – Lidia Mar 03 '10 at 01:15
  • 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 Mar 03 '10 at 10:50
1

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
  • 928
  • 1
  • 19
  • 41
0

After setting Windows Auto-Logon, and launching process not as Windows Service, I found how to solve the Remote Desktop with Black Screenshots problem of IEDriverServer.exe, by creating a batch file that disconnects RDP, instead of closing the RDP session with the regular X button:

%windir%\system32\tscon.exe %SESSIONNAME% /dest:console

See more details here: https://stackoverflow.com/a/24529629/658497

(Although, I would prefer there was a way to run it as the default action, when terminating RDP session with X Windows button).

Community
  • 1
  • 1
Noam Manos
  • 15,216
  • 3
  • 86
  • 85