1
Vote

webdriver screenshot file format

description

Hello,

I’m using the following java code to capture screenshot of physical windows device (Nokia Lumia 1520), which has Windows phone Webdriver installed and running.

File source = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);

Screenshot image is received as .png file, but I’ve noticed that there was lot of noise on the picture not typical for .png. On closer look in HEX editor I’ve found that the screenshot is actually .jpg format

Is it possible to have .png image with lossless compression or at least .jpg with no or minimal compression? I need such clear images for automated image comparison.

Kind regards,
Bozhko

comments

vjrantal wrote May 7, 2015 at 12:07 PM

You are right that the screenshot is currently returned as JPEG even though the WebDriver specification states it should be a PNG. This might have been a "shortcut", because there was an in-built function SaveJpeg, but no equivalent for PNGs.

I checked that there might be a library available (http://toolstack.com/libraries/pngwriter) that could be usable for this scenario to align the format with the specification. Do you have the possibility to try to implement this yourself?

By the way, are you using the current stable release (https://winphonewebdriver.codeplex.com/releases/view/115314) or the experimental release (https://winphonewebdriver.codeplex.com/releases/view/611322)?

vjrantal wrote May 8, 2015 at 11:28 AM

I uploaded a new experimental release to https://winphonewebdriver.codeplex.com/releases/view/611322 that should return PNGs. It you used to use the older stable release, note that this one doesn't work with the deployment tool, but you have to deploy it as you would deploy any .xap file.

I tested on device with https://github.com/rtomac/robotframework-selenium2library/tree/master/demo and this is the kind of PNG it produced:

Image

bozhkotodorov wrote May 11, 2015 at 8:18 AM

Hi,

Thank you for your prompt reaction!
I'm gonna test the new experimental release and I'll let you know

on the previous quiestion: i was using the experimental release

Kind regards,
Bozhko

bozhkotodorov wrote May 12, 2015 at 7:17 AM

Hello,

Works great, producing nice .png images.

Thank you!
Bozhko