PyLinuxAuto
Linux GUI Automation with Python.
PyLinuxAuto 是一个用于 Linux 桌面 GUI 自动化测试的 Python 模块,支持多种元素定位方法和键鼠操作。
文档:https://youqu.uniontech.com/
安装
pip3 install pylinuxauto
使用说明
键鼠控制
import pylinuxauto
pylinuxauto.click()
pylinuxauto.double_click()
使用 Accessibility 操作元素
通过 Accessibility 路径查找并操作元素,路径名称可以通过 sniff 命令查看。
import pylinuxauto
pylinuxauto.find_element_by_attr_path("/dde-doc/Btn_文件管理器").click()
使用图像识别操作元素
传入一张目标图片的路径,自动在当前屏幕中查找目标图片。
import pylinuxauto
from pylinuxauto.config import config
config.IMAGE_SERVER_IP = "192.168.0.1"
pylinuxauto.find_element_by_image("~/Desktop/template.png").click()
使用 OCR 操作元素
使用传入需要识别的文本字符,使用 OCR 在当前屏幕中识别。
import pylinuxauto
from pylinuxauto.config import config
config.OCR_SERVER_IP = "192.168.0.1"
pylinuxauto.find_element_by_ocr("中国").click()
使用 UI 相对位移操作元素
通过将目标按钮相对于应用窗口的位置信息,然后动态获取应用窗口在当前屏幕中的信息,最后计算出目标按钮在当前屏幕中的位置。
import pylinuxauto
from pylinuxauto import Ele, Ref
close_btn = Ele(xy=(25, 25), ref=Ref.RIGHT_TOP, appname="dde-file-manager", alias="关闭按钮")
pylinuxauto.find_element_by_ref(close_btn).click()
pylinuxauto.find_element_by_ref(close_btn).right_click()
开源许可证
PyLinuxAuto 在 GPL-2.0 下发布。
Metadata
Release files for pylinuxauto 2024.12.25
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pylinuxauto-2024.12.25.tar.gz | 145.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pylinuxauto-2024.12.25-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 309.2 kB
Release files / pylinuxauto-2024.12.25.tar.gz
| Download URL | pylinuxauto-2024.12.25.tar.gz |
|---|---|
| Size | 145.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
02d9982e5216df72e60b480ea3114c81a26511d8c753ce14e8910397fdf22f94
|
|
BLAKE2b-256 checksum How to use checksums |
f68d78b07711b495bab57c5ea529cea4dffaeb25e896d0d562e76547da1f57cc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.7.3
|
Release files / pylinuxauto-2024.12.25-py3-none-any.whl
| Download URL | pylinuxauto-2024.12.25-py3-none-any.whl |
|---|---|
| Size | 164.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ce98c0d4a1e5f2f886d35f4db189c5f6f292f047f45252250c870083753e513d
|
|
BLAKE2b-256 checksum How to use checksums |
d749869837fe2ab13d985b732e39cdad2b6cba1a84c3a81798c45c2c198363cd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.7.3
|