Ubuntu – pywinauto equivalent to automate the GUI from Python

pythonsoftware-recommendation

pywinauto is a set of python modules to automate the Microsoft Windows GUI. At it’s simplest it allows you to send mouse and keyboard actions to windows dialogs and controls.

Is there a linux equivalent of this python module?

thanks!

Best Answer

The linux desktop testing project (ldtp) should offer what you need. With the python-ldtp Install python-ldtp package, you can write scripts in python. The project uses the accessibility methods to perform actions, so the application in question has to be a “standard” GTK/QT/… application and you need to enable accessibility (“Assistive technologies”).

sudo apt-get install python-ldtp

The following python script would click the “New” button in an (already existing) gedit window and enter the string foo:

#!/usr/bin/python

from ldtp import *
from ldtputils import *
click('*-gedit', 'btnNew') 
generatekeyevent('foo')