No project description provided
Project description
PyLinuxAuto
Linux GUI Automation with Python.
PyLinuxAuto 是一个用于 Linux 桌面 GUI 自动化测试的 Python 模块,支持多种元素定位方法和键鼠操作。
文档:https://youqu.uniontech.com/pylinuxauto
安装
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 相对位移操作元素
通过将目标按钮相对于应用窗口的位置信息配置到 ini 文件里面,然后动态获取应用窗口在当前屏幕中的信息,最后计算出目标按钮在当前屏幕中的位置。
import pylinuxauto
pylinuxauto.find_element_by_ui(
appname="dde-file-manager",
config_path="~/Desktop/ui.ini",
btn_name="最大化按钮"
).click()
开源许可证
PyLinuxAuto 在 GPL-2.0 下发布。
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pylinuxauto-2024.8.31.tar.gz
(134.2 kB
view hashes)
Built Distribution
Close
Hashes for pylinuxauto-2024.8.31-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0cce7e829f6b0523f007329b1bbadf42f4795f7dd7e86a39f04763a01c51d74f |
|
MD5 | 3c52dc4c999f4d0b64d649d380b032cb |
|
BLAKE2b-256 | a67f01ee6cab871475c96d9c801f63505a684a8987517a7921b23827d0c9055d |