Blank Screenshots - SeleniumRC with Xvfb

View: New views
1 Messages — Rating Filter:   Alert me  

Blank Screenshots - SeleniumRC with Xvfb

by Subash Chandran :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I have my tests written in java and use the latest Selenium java client driver to run the tests.
The selenium server and browser port is on another unix box with no physical display.
I am using Xvfb to run the browser tests on a virtual frame buffer.

The tests are running super fine so far without any issues. now i had to come up with screenshots for the test failures.So i implemented the below code to get the screenshots on every test failure.

Now the problem is the screenshots work great when i run on a seleniun server port on a physical box with physical display.
But when i run this against the Xvfb instance all i get is a black blank image.

Please help us out if someone knows why this happens and if any one has faced this issue kindly let us know if there is a workaround for this.

Thanks
----------------------------------------------------------------------------------------

String screenStream = captureEntirePageScreenshotToString("background=#CCFFDD");
try
{
InputStream in = MimeUtility.decode(new ByteArrayInputStream(screenStream.getBytes()),"base64");
byte[] buf = new byte[1024];
ByteArrayOutputStream out = new ByteArrayOutputStream();
int len;
while ((len = in.read(buf)) != -1) {
out.write(buf, 0, len);
}
FileOutputStream fout = new FileOutputStream(screenshotFile);
out.writeTo(fout);
fout.close();
out.close();
}
catch(Exception ex) {
ex.printStackTrace();
}
----------------------------------------------------------------------------------