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
- Request your free 30 day Squish evaluation
- Learn more about Squish
- Other Squish Resources (videos, tech articles, user communities and more)
2 Comments
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.
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