object.grabScreenshot

Image object.grabScreenshot(object, [parameterMap])

This function takes an object reference (as returned by the Object findObject(objectName) function or by the Object waitForObject(objectOrName) function), and returns a screenshot of its current visual as an Image Object.

The screenshot behavior can be configured through entries passed via the optional parameterMap argument.

  • delay - The delay before taking the screenshot in milliseconds. The default value is 1000 (1 second) to allow the AUT to react to the latest inputs and reach a stable state before taking a screenshot. Reducing it to 0 may be useful to improve the test execution time, especially in case of a series of consecutive grabScreenshot() calls.
var obj = waitForObject(":MyWidget");
var img = object.grabScreenshot(obj, {delay: 0});
test.attachImage(img);
y $obj = waitForObject(":MyWidget");
my $img = object::grabScreenshot($obj, {"delay" => 0});
test::attachImage($img);
obj = waitForObject(":MyWidget")
img = object.grabScreenshot(obj, {"delay": 0})
test.attachImage(img)
obj = waitForObject(":MyWidget")
img = Squish::Object.grabScreenshot(obj, {"delay" => 0})
Test.attachImage(img)
set obj [waitForObject ":MyWidget"]
set img [object grabScreenshot $obj {delay 0}]
test attachImage $img

© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners.
The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation.
Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.

Search Results