There are much clerical works in desktop client side which are repeatitive tasks, like filling forms, sending messages to multiple groups, manipulating ERP system etc. These operations cost much of employees' time, and automating these client side software to reduce human time in these operations is a good alternative.
There are some options to do the software automation, and I will introduce Pywinauto and Clicknium as below.
Pywinauto is a set of python modules to automate the Microsoft Windows GUI. At its simplest it allows you to send mouse and keyboard actions to windows dialogs and controls, but it has support for more complex actions like getting text data.
Supported technologies under the hood : Win32 API (
backend="win32"; used by default ), MS UI Automation (
backend="uia"). User input emulation modules
keyboard work on both Windows and Linux.
pip install -U pywinauto( dependencies will be installed automatically )
Clicknium is a new generation automation framework supporting GUI automation for all types of applications. Automation development efficiency is highly improved, including developer tooling support and cloud native data management for collaboration.
pip install clicknium
install Visual Studio Code Extension
Difference in capturing locators
For Pywinauto, UISpy.exe needs to be leveraged to capture UI locators. The application need to be differentiated between WinApi and Uia.
Clicknium provides Recorder to locate and capture UI elements.
A Sample for Windows GUI automation
The sample is as below :
- Open notepad
- Type some string into notepad , eg: " hello automation "
- Close notepad without saving
Capture UI elements with the Clicknium extension
Python code with Clicknium as below, you may go to Github for source code
from clicknium import locator, ui
process = subprocess.Popen("notepad")
- Capture UI elements with UISpy.exe
- With details captured in UISpy.exe in above step, you may write python code as below.
from pywinauto.application import Application
app = Application(backend='uia').start("notepad.exe")
app.UntitledNotepad.Edit.type_keys("hello automation", with_spaces = True)
main = app.window(title='*Untitled - Notepad', control_type='Window')
closeDlg=main.child_window(title="Don't Save", control_type='Button')
From the sample above, with Clicknium Recorder and Locator, the automation process can be implemented easily. By using UISpy.exe, the developer needs to understand the properties that can be used to locate element, and the format of locator string in code which requires additional learning cost.
What is more, Clicknium also support Web automation with same programming interface. So in any case that you need to do web automation, you can save cost of finding another python module.