Skip to main content

Python implementation for Java application UI automation with Java Access Bridge

Project description

Python implementation for Java application UI automation with Java Access Bridge.

The pyjab package enables run UI automation(selenium like) through with Java UI application. Package will invoke Java Access Bridge API to get information form Java application. And this package is only support for Windows. Sources code referenced from NVDA.

Installation

The pyjab package is available on PyPI which means installation should be as simple as:

$ pip install pyjab

There’s actually a multitude of ways to install Python packages (e.g. the per user site-packages directory, virtual environments or just installing system wide) and I have no intention of getting into that discussion here, so if this intimidates you then read up on your options before returning to these instructions.

Optional dependencies

Access Bridge Explorer is a Windows application that allows exploring, as well as interacting with, the Accessibility tree of any Java applications that uses the Java Access Bridge to expose their accessibility features, for example Android Studio and IntelliJ.

Usage

JRE, JDK or JAB standalone package is required. Need setup environment variable JAVA_HOME or JAB_HOME before usage.

Here’s an example of how easy it is to get started:

from pyjab.jabdriver import JABDriver

# Create a JABDriver object.
jabdriver = JABDriver("java app window title")

# Find a JABElement by element name
login_btn = jabdriver.find_element_by_name("Login")

# Click a JABElement
login_btn.click()

# Some other examples.
jabdriver.find_element_by_xpath("//push button[@name=contains('OK')]")
jabdriver.wait_until_element_exist(by=By.NAME, value="Dashboard")
login_btn.get_screenshot_as_file("./screenshot.png")

You may also use a context manager approach to kill the Java Window after the JABDriver is cleared:

from pyjab.jabdriver import JABDriver

# Create a JABDriver object.
with JABDriver("java app window title") as jabdriver:

    # Find a JABElement by element name
    login_btn = jabdriver.find_element_by_name("Login")

    # Click a JABElement
    login_btn.click()

You can also open the Java window process by specifying the file path which will launch the Java WebStart process for the given file :

from pyjab.jabdriver import JABDriver

# Create a JABDriver object.
with JABDriver(title="java app window title", file_path="C:\\jnlps\\test.jnlp") as jabdriver:

    # Find a JABElement by element name
    login_btn = jabdriver.find_element_by_name("Login")

    # Click a JABElement
    login_btn.click()

Contact

The latest version of pyjab is available on PyPI and GitHub. For bug reports please create an issue on GitHub. If you have questions, suggestions, etc. feel free to send me an e-mail at gaozhao89@qq.com.

License

This software is licensed under the GPLv2 license.

© 2021 Gary Gao.

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

pyjab-1.1.7.tar.gz (38.4 kB view details)

Uploaded Source

Built Distribution

pyjab-1.1.7-py2.py3-none-any.whl (40.5 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file pyjab-1.1.7.tar.gz.

File metadata

  • Download URL: pyjab-1.1.7.tar.gz
  • Upload date:
  • Size: 38.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

File hashes

Hashes for pyjab-1.1.7.tar.gz
Algorithm Hash digest
SHA256 02e81437fe2b6c2469a4b4a37661cea703c5038f0db38a7e2548f960754fb467
MD5 ed6bdb43c46b59fabb8b5109d1d56b1a
BLAKE2b-256 433e3add7ca5602ff6b527de41805af5a955a111cc0bdbc6fde8933a00fc5644

See more details on using hashes here.

File details

Details for the file pyjab-1.1.7-py2.py3-none-any.whl.

File metadata

  • Download URL: pyjab-1.1.7-py2.py3-none-any.whl
  • Upload date:
  • Size: 40.5 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

File hashes

Hashes for pyjab-1.1.7-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 d06ef88f33c03b9eeb25af75bb32e0c1d9e0b189122fecb18bd5d90e29e62436
MD5 05026d84683905c5b402175f88fac7e1
BLAKE2b-256 27eac7b171b94a0f8f2959863cbf4685367f30b48d65a615f139bec116f199b4

See more details on using hashes here.

Supported by

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