Squish tip of the week: How to execute keyboard and mouse combination commands

Squish tip of the week: How to execute keyboard and mouse combination commands

How can I perform a keyboard + mouse combination in a test script?

The mouseClick function accepts a modifierState and a button. The modifier state accepts a set of keyboard commands.
Take for example performing a Control + Shift + Right Click

Given a Java Swing application, Shift is 1 and Control is 2
Which results in mouseClick(“:myObject”, 5, 5, 1|2, Button.Button3), where the Shift + Control keys are pressed, followed by Button3, or a right click.

Each application type may use different modifier values:

Java Applications
Qt Applications
Flex Applications
Tk Applications
Web Applications
Windows Applications

Additional Resources

2 Comments

  1. Stewart Grierson 4 years ago

    Hello,

    I am testing a Qt application using Squish with Python. The recording does not capture a KeyPress event. Why not? After inserting KeyPress manually the script runs perfectly fine. But when I run the same script from the command line the KeyPress does not work. Is this a known error or is something else stopping the script from executing?

    Hope to hear from you soon.

    Stewart Grierson

    • Ant 4 years ago

      I’m also seeing this with a QML / Qt 5.7.1 Desktop App. When we added a MenuItem to the main Menubar that has a shortcut (Ctrl/Cmd+R), the keypress does not get triggered.

Leave a reply

Your email address will not be published. Required fields are marked *

*