Sunday 6 October 2013

Capturing screenshots from Selenium IDE



how to Capturing screenshots from Selenium IDE?

There are two ways to capturing screenshot from selenium IDE.
1. captureEntirePageScreenshot
Saves the entire contents of the current window canvas to a PNG file. Contrast this with the captureScreenshot command, which captures the contents of the OS viewport (i.e. whatever is currently being displayed on the monitor), and is implemented in the RC only. Currently this only works in Firefox when running in chrome mode, and in IE non-HTA using the EXPERIMENTAL "Snapsie" utility. The Firefox implementation is mostly borrowed from the Screengrab! Firefox extension.
public void CaptureEntirePageScreenshot(
   
string filename,
   
string kwargs
);

Parameters

filename
the path to the file to persist the screenshot as. No filename extension will be appended by default. Directories will not be created if they do not exist, and an exception will be thrown, possibly by native code.
kwargs
a kwargs string that modifies the way the screenshot is captured. Example: "background=#CCFFDD" . Currently valid options:
background
the background CSS for the HTML document. This may be useful to set for capturing screenshots of less-than-ideal layouts, for example where absolute positioning causes the calculation of the canvas dimension to fail and a black background is exposed (possibly obscuring black text).
Saves the entire contents of the current window canvas to a PNG file. Contrast this with the captureScreenshot command, which captures the contents of the OS viewport (i.e. whatever is currently being displayed on the monitor), and is implemented in the RC only. Currently this only works in Firefox when running in chrome mode, and in IE non-HTA using the EXPERIMENTAL "Snapsie" utility. The Firefox implementation is mostly borrowed from the Screengrab! Firefox extension.
void CaptureEntirePageScreenshot(
   
string filename,
   
string kwargs
);

Parameters

filename
the path to the file to persist the screenshot as. No filename extension will be appended by default. Directories will not be created if they do not exist, and an exception will be thrown, possibly by native code.
kwargs
a kwargs string that modifies the way the screenshot is captured. Example: "background=#CCFFDD" . Currently valid options:
background
the background CSS for the HTML document. This may be useful to set for capturing screenshots of less-than-ideal layouts, for example where absolute positioning causes the calculation of the canvas dimension to fail and a black background is exposed (possibly obscuring black text).

We are going to take screenshot of flipKart.com
We make one blank image file screenshot.png under C:/
Now open Firefox and start Selenium IDE.
Enter command to capture screenshot and enter file path as following and Run the test and verify image at image location.




Selenium IDE Plugins – ScreenShot on Fail (Selenium IDE)
A plugin for Selenium-IDE to automatically take a screen-shot when a command fails while running the test suite
PlugInLink
Add appropriate file path in Change reports folder and click that icon before start execution of TestCases using selenium IDE.
This plugin automatically take image when any error fired or assertion fails and store image of that and save to file location.

Selenium IDE Plugins – ScreenS



No comments:

Post a Comment