_takePageScreenShot([$element[, $fileSysPath[, $noLog[, $props]]]])
$element | HTML DOM element optional | If specified, a full page screenshot of the element would be taken |
$fileSysPath | string optional | File system path to save a copy of the screenshot, additionally to. Relative paths will be resolved relative to current executing script. Default is null. |
$noLog | boolean optional | Pass true to prevent embedding the image in the playback log. Default is false |
$props | object optional | Properties to specify for image delay, scrollLimit, trim, format and image compression in percentage(resizePercentage). 1. delay, integer, optional, time delay between scroll and screenshot in milliseconds. For long pages, the page is scrolled, individual screenshots are taken and then stitched. Sometimes images on the page may load slowly on scroll and a wait may be needed between scroll and screenshot. Default is 100 ms. 2. scrollLimit, integer, optional, height in pixels. Maximum scroll size in pixels for a page/element. Default is 200000. 3. trim, boolean, optional, Trim the image for blank space. Default is true. This works only if Graphics Magick is installed and configured correctly. Fails silently if not installed. 4. format, string, optional, can be GIF, JPG or PNG Default is "sahi.takeScreenShot_image.format" property defined in config/sahi.properties. This can be overridden in userdata/config/userdata.properties 5. resizePercentage, integer, optional Default is "sahi.takeScreenShot_image.resize_percentage" property defined in config/sahi.properties. This can be overridden in userdata/config/userdata.properties. 100 means no compression. |
_focusWindow
to bring the window into focus._focusWindow(); // Brings window into focus
_takePageScreenShot(); // Captures the full browser page screenshot
_takePageScreenShot(_table("t4")); // Captures the table screenshot
// Captures table screenshot with jpg format, compresses file size to 75% of the full size, saves it to D:\dev\capture.jpg
// without embedding image in the playback log
_takePageScreenShot(_table("t4"), "D:\\dev\\capture.jpg", true, {format:'jpg', resizePercentage:75});
$element | HTML DOM element optional | If specified, a full page screenshot of the element would be taken |
$fileSysPath | string optional | File system path to save a copy of the screenshot, additionally to. Relative paths will be resolved relative to current executing script. Default is null. |
$noLog | boolean optional | Pass true to prevent embedding the image in the playback log. Default is false |
$props | object optional | Properties to specify for image delay, scrollLimit, trim, format and image compression in percentage(resizePercentage). 1. delay, integer, optional, time delay between scroll and screenshot in milliseconds. For long pages, the page is scrolled, individual screenshots are taken and then stitched. Sometimes images on the page may load slowly on scroll and a wait may be needed between scroll and screenshot. Default is 100 ms. 2. scrollLimit, integer, optional, height in pixels. Maximum scroll size in pixels for a page/element. Default is 200000. 3. trim, boolean, optional, Trim the image for blank space. Default is true. This works only if Graphics Magick is installed and configured correctly. Fails silently if not installed. 4. format, string, optional, can be GIF, JPG or PNG Default is "sahi.takeScreenShot_image.format" property defined in config/sahi.properties. This can be overridden in userdata/config/userdata.properties 5. resizePercentage, integer, optional Default is "sahi.takeScreenShot_image.resize_percentage" property defined in config/sahi.properties. This can be overridden in userdata/config/userdata.properties. 100 means no compression. |