Skip to main content

Python UI Automation library, for cross-platform applications, interfacing through the accessibility API

Project description

pyUIauto

PyPi version PyPi license PyPI pyversions

Python UI Automation library, for cross-platform applications, interfacing through the accessibility API.

Description

This library / framework takes two popular UI automation libraries and combines their functionality by wrapping them into custom components and creating methods that function in similar ways for both OS. This project was originally designed as part of a QA automation project to perform end-to-end testing on desktop applications.

⤴️: Open source: This project is open source and welcomes any pull requests and further improvements!

Getting Started

Dependencies

Python Packages:

  • pywinauto (Windows / Linux)
  • atomacos (MacOS)
  • pyautogui

OS Compatibility:

  • Windows
  • MacOS

( Currently untested on Linux )

Example

# Import the tools needed
from platform import system
import os
from pyuiauto.application import UIApplication
from pyuiauto.components import UIButton

# Finding the path location of the application
app_paths = {
  "Darwin": "/Applications/Visual Studio Code.app",
  "Windows": os.path.expanduser('~') + "\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe"
}

if system() in app_paths:
  appPath = app_paths[system()]
else:
  raise NotImplementedError("The current OS is not currently supported: " + system())

# Setting up an application template, launching the app, and connecting to it
app = UIApplication(appName = "Visual Studio Code", appPath = appPath)
app.launchApp()
app.connectApp()

# Finding the window component and searching for elements within this window component
main_window = app.window(title = "Visual Studio Code", timeout = 2)
main_window.findR(title = "Toggle Primary Side Bar (Ctrl+B)", control_type = UIButton).press() '''  press will invoke a button without manually moving the mouse and clicking it 
                                                                                          (a button could be invoked even if it isn't currently visible)  '''
main_window.findR(title = "Open Folder", control_type = UIButton).click() ''' however, click will move the mouse to the button location and click it
                                                                    (sometimes this can be more reliable) '''

# Closing the window and terminating the application
main_window.close()
app.terminateApp()

Authors

ex. Harvey Fretwell

ex. pyWinAuto

ex. atomacos

ex. pyAutoGUI

Version History

  • 0.1
    • Initial Release
    • 0.1.1
      • Added UISystemTrayIcon and UIPopupMenu manager
    • 0.1.4
      • Fixed some issues with setValue() method on buttons and menus
    • 0.1.5
      • Added context managers for better popup menu handling
    • 0.1.6
      • Added isOnTop method for components
      • Fixed isVisible method for components
      • Added checks for components existing in helper methods
    • 0.1.7
      • Added MacOS compatibility
      • Fixed getValue method for mac on menu items (with a bit of a work around ... hoping to find a better solution soon)
      • Fixed menu path select and system tray popup select methods on mac
    • 0.1.8
      • Fixed progress bar get value method
      • Added better python intellisense for pylance
      • Added further checks for system tray icon
      • Updated application.py
      • Upgraded package versions
    • 0.1.9
      • Added CheckBox component
    • 0.1.10
      • Added popup button for MacOS
    • 0.1.11
      • Fixed getChildren
      • Fixed popup menu navigation
    • 0.1.12
      • Fixed Windows UIRadioButton getValue

Acknowledgments

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyuiauto-0.1.12.tar.gz (42.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyuiauto-0.1.12-py3-none-any.whl (44.3 kB view details)

Uploaded Python 3

File details

Details for the file pyuiauto-0.1.12.tar.gz.

File metadata

  • Download URL: pyuiauto-0.1.12.tar.gz
  • Upload date:
  • Size: 42.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.7 Darwin/24.5.0

File hashes

Hashes for pyuiauto-0.1.12.tar.gz
Algorithm Hash digest
SHA256 5f38f181e46dc8bb3a56191fa67f083d37681440f8efda12a804a7bb3fb0f12e
MD5 b539d21efa4ec7be16490744613bf0a1
BLAKE2b-256 a133f17dd6495c1956a777385bd70ff09481ba339d7b4df8ef9b58b4876fd794

See more details on using hashes here.

File details

Details for the file pyuiauto-0.1.12-py3-none-any.whl.

File metadata

  • Download URL: pyuiauto-0.1.12-py3-none-any.whl
  • Upload date:
  • Size: 44.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.7 Darwin/24.5.0

File hashes

Hashes for pyuiauto-0.1.12-py3-none-any.whl
Algorithm Hash digest
SHA256 f095a28dd03481933819f494e0f2c98693db604a673f0f4105270ddf6953ab06
MD5 48b6e695d56e731a6873c83e6c962b27
BLAKE2b-256 efa50035b57c7c744efafc0cb9cf8c969118712e13d9b67d19598314a8e8955d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page