Clicknium VS Pywinauto

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.

About Pywinauto

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 mouse and keyboard work on both Windows and Linux.

Setup

  • run “pip install -U pywinauto “( dependencies will be installed automatically )

About Clicknium

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.

Setup

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

Clicknium

Capture UI elements with the Clicknium extension

Python code with Clicknium as below, you may go to Github for source code

import subprocess
from clicknium import locator, ui

process = subprocess.Popen("notepad")
ui(locator.notepad.document_15).set_text("hello automation")
ui(locator.notepad.button_close).click()
ui(locator.notepad.button_commandbutton_7).click()

Pywinauto

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')
closeBtn=main.child_window(title="Close", control_type='Button')
closeBtn.click_input()
closeDlg=main.child_window(title="Don't Save", control_type='Button')
closeDlg.click_input()

Conclusion

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.

What are your feelings