Introduction¶
Here is an example for taking screenshots at runtime, and for comparing images/screenshots at runtime:
import os
import os.path
import subprocess
import sys
def main():
startApplication("myaut")
# Do something in application...
# Create screenshot for comparison:
some_object1 = waitForObject(names.address_Book_Add_Forename_QLabel)
image1 = object.grabScreenshot(some_object1)
# Do something in application...
# Create screenshot for comparison:
some_object2 = waitForObject(names.address_Book_Add_Surname_QLabel)
image2 = object.grabScreenshot(some_object2)
# Compare images:
if image1.equals(image2):
test.passes("Images are identical")
else:
test.fail("Images are different")