Getting Object Screen Position, Location, Coordinates (Qt)

Last edited on


The absolute screen position of an object on the screen can be useful to know for use with the nativeMouseClick() function, and for other purposes.

def main():
    # ...

    pos = waitForObject(":foo").mapToGlobal(QPoint(0, 0))
    test.log("x/y: %d/%d" % (pos.x, pos.y))

Note that mapToGlobal() is a method from the Qt API. As you can see the Qt API can be directly accessed in Squish test scripts.

More Information