# AutoPC
**基于Windows的跨平台的UI自动化框架,适用于游戏和App**([Click here for the English version](https://github.com/orcakill/autopc/blob/master/README_en.md))
## 快速开始
* **各种运行:** AutoPC提供了跨平台的API,包括安装应用、图像识别、模拟输入等。 基于图像识别技术定位UI元素,你无需嵌入任何代码即可进行自动化。
* **扩展性:** AutoPC提供了命令行和python接口,可以很容易地在大规模设备集群上运行。
## 安装
使用 `pip` 安装AutoPC框架
```Shell
pip install -U autopc
```
在Windows系统下操作Android,需要检查设备是否已经通过ADB连接
```Shell
# windows系统
adb devices
```
## 文档
完整的AutoPC文档请看 [readthedocs](http://autopc.readthedocs.io/zh-cn/latest/)。
## 例子
AutoPC提供与平台无关的的python API,让你的自动化代码可以运行Windows上,操作不同平台的应用。
1. 使用 [connect_device](https://autopc.readthedocs.io/zh-cn/latest/source/autopc.basic.basic_airtest.html#auto_step)
来连接任意Android设备或者Windows窗口。
2. 使用 [模拟操作](https://autopc.readthedocs.io/zh-cn/latest/README_MORE.html#id9) 的API来自动化你的游戏或者App。
```Python
from autopc.basic.basic_airtest import *
# 通过ADB连接本地Android设备
BasicAirtest.auto_setup("Android")
# 启动APP
BasicAirtest.adb_start_app("package_name_of_your_apk")
# 点击屏幕的图片
BasicAirtest.touch(Template("image_of_a_button.png"))
# 从图片1滑动到图片2
BasicAirtest.swipe(Template("slide_start.png"), Template("slide_end.png"))
```
更详细的说明请看 [AutoPC Python API 文档](https://autopc.readthedocs.io/zh-cn/latest/source/autopc.basic.basic_airtest.html)
或者直接看 [API代码](../autopc/autopc/basic/basic_airtest.py) 。
## 贡献代码
欢迎大家fork和提pull requests。
## 致谢
感谢以下仓库让AutoPC变得更好:
- [stf](https://github.com/openstf)
- [opencv](https://github.com/opencv/opencv-python)
- [airtest](https://github.com/AirtestProject/Airtest)
## 关于我
个人开发者
Raw data
{
"_id": null,
"home_page": "https://github.com/orcakill/autopc",
"name": "autopc",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "automation, opencv-python, ocr",
"author": "orcakill",
"author_email": "orcakill@dingtalk.com",
"download_url": "https://files.pythonhosted.org/packages/8f/75/b0dff01e4aba73c5ca1230669f40ffa6f2f641cc69c35ff8c9aff1bcbc73/autopc-1.0.1.tar.gz",
"platform": null,
"description": "# AutoPC\r\n\r\n**\u57fa\u4e8eWindows\u7684\u8de8\u5e73\u53f0\u7684UI\u81ea\u52a8\u5316\u6846\u67b6\uff0c\u9002\u7528\u4e8e\u6e38\u620f\u548cApp**\uff08[Click here for the English version](https://github.com/orcakill/autopc/blob/master/README_en.md)\uff09\r\n\r\n## \u5feb\u901f\u5f00\u59cb\r\n\r\n* **\u5404\u79cd\u8fd0\u884c\uff1a** AutoPC\u63d0\u4f9b\u4e86\u8de8\u5e73\u53f0\u7684API\uff0c\u5305\u62ec\u5b89\u88c5\u5e94\u7528\u3001\u56fe\u50cf\u8bc6\u522b\u3001\u6a21\u62df\u8f93\u5165\u7b49\u3002 \u57fa\u4e8e\u56fe\u50cf\u8bc6\u522b\u6280\u672f\u5b9a\u4f4dUI\u5143\u7d20\uff0c\u4f60\u65e0\u9700\u5d4c\u5165\u4efb\u4f55\u4ee3\u7801\u5373\u53ef\u8fdb\u884c\u81ea\u52a8\u5316\u3002\r\n\r\n* **\u6269\u5c55\u6027\uff1a** AutoPC\u63d0\u4f9b\u4e86\u547d\u4ee4\u884c\u548cpython\u63a5\u53e3\uff0c\u53ef\u4ee5\u5f88\u5bb9\u6613\u5730\u5728\u5927\u89c4\u6a21\u8bbe\u5907\u96c6\u7fa4\u4e0a\u8fd0\u884c\u3002\r\n\r\n## \u5b89\u88c5\r\n\r\n\u4f7f\u7528 `pip` \u5b89\u88c5AutoPC\u6846\u67b6\r\n\r\n```Shell\r\npip install -U autopc\r\n```\r\n\r\n\u5728Windows\u7cfb\u7edf\u4e0b\u64cd\u4f5cAndroid\uff0c\u9700\u8981\u68c0\u67e5\u8bbe\u5907\u662f\u5426\u5df2\u7ecf\u901a\u8fc7ADB\u8fde\u63a5\r\n\r\n```Shell\r\n# windows\u7cfb\u7edf\r\nadb devices\r\n```\r\n\r\n## \u6587\u6863\r\n\r\n\u5b8c\u6574\u7684AutoPC\u6587\u6863\u8bf7\u770b [readthedocs](http://autopc.readthedocs.io/zh-cn/latest/)\u3002\r\n\r\n## \u4f8b\u5b50\r\n\r\nAutoPC\u63d0\u4f9b\u4e0e\u5e73\u53f0\u65e0\u5173\u7684\u7684python API\uff0c\u8ba9\u4f60\u7684\u81ea\u52a8\u5316\u4ee3\u7801\u53ef\u4ee5\u8fd0\u884cWindows\u4e0a\uff0c\u64cd\u4f5c\u4e0d\u540c\u5e73\u53f0\u7684\u5e94\u7528\u3002\r\n\r\n1. \u4f7f\u7528 [connect_device](https://autopc.readthedocs.io/zh-cn/latest/source/autopc.basic.basic_airtest.html#auto_step)\r\n \u6765\u8fde\u63a5\u4efb\u610fAndroid\u8bbe\u5907\u6216\u8005Windows\u7a97\u53e3\u3002\r\n2. \u4f7f\u7528 [\u6a21\u62df\u64cd\u4f5c](https://autopc.readthedocs.io/zh-cn/latest/README_MORE.html#id9) \u7684API\u6765\u81ea\u52a8\u5316\u4f60\u7684\u6e38\u620f\u6216\u8005App\u3002\r\n\r\n```Python\r\nfrom autopc.basic.basic_airtest import *\r\n\r\n# \u901a\u8fc7ADB\u8fde\u63a5\u672c\u5730Android\u8bbe\u5907\r\nBasicAirtest.auto_setup(\"Android\")\r\n# \u542f\u52a8APP\r\nBasicAirtest.adb_start_app(\"package_name_of_your_apk\")\r\n# \u70b9\u51fb\u5c4f\u5e55\u7684\u56fe\u7247\r\nBasicAirtest.touch(Template(\"image_of_a_button.png\"))\r\n# \u4ece\u56fe\u72471\u6ed1\u52a8\u5230\u56fe\u72472\r\nBasicAirtest.swipe(Template(\"slide_start.png\"), Template(\"slide_end.png\"))\r\n```\r\n\r\n\u66f4\u8be6\u7ec6\u7684\u8bf4\u660e\u8bf7\u770b [AutoPC Python API \u6587\u6863](https://autopc.readthedocs.io/zh-cn/latest/source/autopc.basic.basic_airtest.html)\r\n\u6216\u8005\u76f4\u63a5\u770b [API\u4ee3\u7801](../autopc/autopc/basic/basic_airtest.py) \u3002\r\n\r\n## \u8d21\u732e\u4ee3\u7801\r\n\r\n\u6b22\u8fce\u5927\u5bb6fork\u548c\u63d0pull requests\u3002\r\n\r\n## \u81f4\u8c22\r\n\r\n\u611f\u8c22\u4ee5\u4e0b\u4ed3\u5e93\u8ba9AutoPC\u53d8\u5f97\u66f4\u597d\uff1a\r\n\r\n- [stf](https://github.com/openstf)\r\n- [opencv](https://github.com/opencv/opencv-python)\r\n- [airtest](https://github.com/AirtestProject/Airtest)\r\n\r\n## \u5173\u4e8e\u6211\r\n\r\n\u4e2a\u4eba\u5f00\u53d1\u8005\r\n",
"bugtrack_url": null,
"license": "Apache License 2.0",
"summary": "An image recognition framework running on a computer",
"version": "1.0.1",
"project_urls": {
"Homepage": "https://github.com/orcakill/autopc"
},
"split_keywords": [
"automation",
" opencv-python",
" ocr"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "6aa645324a40c7452168df4c1fd3a02c5289e46ccacc18f58a15af62ebc5715e",
"md5": "5aba22bfb5312231fed7edca216eae28",
"sha256": "8d7b2a0f0772ecd1835a011052685dd8031cdb65a0bd979ebd0544011a6bad60"
},
"downloads": -1,
"filename": "autopc-1.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "5aba22bfb5312231fed7edca216eae28",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 15948,
"upload_time": "2025-01-08T07:42:19",
"upload_time_iso_8601": "2025-01-08T07:42:19.754276Z",
"url": "https://files.pythonhosted.org/packages/6a/a6/45324a40c7452168df4c1fd3a02c5289e46ccacc18f58a15af62ebc5715e/autopc-1.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "8f75b0dff01e4aba73c5ca1230669f40ffa6f2f641cc69c35ff8c9aff1bcbc73",
"md5": "4e7564dd3c28d3684994392704555aa4",
"sha256": "30d151eb77f9fdcf9961c2303028feecc5fdc897075a62526ccc98fcee8852c2"
},
"downloads": -1,
"filename": "autopc-1.0.1.tar.gz",
"has_sig": false,
"md5_digest": "4e7564dd3c28d3684994392704555aa4",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 17916,
"upload_time": "2025-01-08T07:42:22",
"upload_time_iso_8601": "2025-01-08T07:42:22.667824Z",
"url": "https://files.pythonhosted.org/packages/8f/75/b0dff01e4aba73c5ca1230669f40ffa6f2f641cc69c35ff8c9aff1bcbc73/autopc-1.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-08 07:42:22",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "orcakill",
"github_project": "autopc",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "airtest",
"specs": [
[
"==",
"1.3.5"
]
]
},
{
"name": "alabaster",
"specs": [
[
"==",
"0.7.16"
]
]
},
{
"name": "annotated-types",
"specs": [
[
"==",
"0.7.0"
]
]
},
{
"name": "asttokens",
"specs": [
[
"==",
"3.0.0"
]
]
},
{
"name": "attrs",
"specs": [
[
"==",
"24.3.0"
]
]
},
{
"name": "babel",
"specs": [
[
"==",
"2.16.0"
]
]
},
{
"name": "backcall",
"specs": [
[
"==",
"0.2.0"
]
]
},
{
"name": "backports.tarfile",
"specs": [
[
"==",
"1.2.0"
]
]
},
{
"name": "beautifulsoup4",
"specs": [
[
"==",
"4.12.3"
]
]
},
{
"name": "bleach",
"specs": [
[
"==",
"6.2.0"
]
]
},
{
"name": "cached-property",
"specs": [
[
"==",
"1.5.2"
]
]
},
{
"name": "certifi",
"specs": [
[
"==",
"2024.8.30"
]
]
},
{
"name": "chardet",
"specs": [
[
"==",
"5.2.0"
]
]
},
{
"name": "charset-normalizer",
"specs": [
[
"==",
"3.3.2"
]
]
},
{
"name": "click",
"specs": [
[
"==",
"8.1.7"
]
]
},
{
"name": "colorama",
"specs": [
[
"==",
"0.4.6"
]
]
},
{
"name": "colored",
"specs": [
[
"==",
"2.2.4"
]
]
},
{
"name": "commonmark",
"specs": [
[
"==",
"0.9.1"
]
]
},
{
"name": "comtypes",
"specs": [
[
"==",
"1.4.7"
]
]
},
{
"name": "construct",
"specs": [
[
"==",
"2.10.70"
]
]
},
{
"name": "decorator",
"specs": [
[
"==",
"5.1.1"
]
]
},
{
"name": "defusedxml",
"specs": [
[
"==",
"0.7.1"
]
]
},
{
"name": "Deprecated",
"specs": [
[
"==",
"1.2.14"
]
]
},
{
"name": "deprecation",
"specs": [
[
"==",
"2.1.0"
]
]
},
{
"name": "docopt",
"specs": [
[
"==",
"0.6.2"
]
]
},
{
"name": "docutils",
"specs": [
[
"==",
"0.21.2"
]
]
},
{
"name": "executing",
"specs": [
[
"==",
"2.1.0"
]
]
},
{
"name": "facebook-wda",
"specs": [
[
"==",
"1.4.9"
]
]
},
{
"name": "fastjsonschema",
"specs": [
[
"==",
"2.21.1"
]
]
},
{
"name": "ffmpeg-python",
"specs": [
[
"==",
"0.2.0"
]
]
},
{
"name": "filelock",
"specs": [
[
"==",
"3.16.1"
]
]
},
{
"name": "future",
"specs": [
[
"==",
"1.0.0"
]
]
},
{
"name": "idna",
"specs": [
[
"==",
"3.10"
]
]
},
{
"name": "imageio",
"specs": [
[
"==",
"2.35.1"
]
]
},
{
"name": "imagesize",
"specs": [
[
"==",
"1.4.1"
]
]
},
{
"name": "importlib_metadata",
"specs": [
[
"==",
"8.0.0"
]
]
},
{
"name": "ipython",
"specs": [
[
"==",
"8.12.3"
]
]
},
{
"name": "jaraco.classes",
"specs": [
[
"==",
"3.4.0"
]
]
},
{
"name": "jaraco.context",
"specs": [
[
"==",
"5.3.0"
]
]
},
{
"name": "jaraco.functools",
"specs": [
[
"==",
"4.0.1"
]
]
},
{
"name": "jedi",
"specs": [
[
"==",
"0.19.2"
]
]
},
{
"name": "Jinja2",
"specs": [
[
"==",
"3.1.4"
]
]
},
{
"name": "jsonschema",
"specs": [
[
"==",
"4.23.0"
]
]
},
{
"name": "jsonschema-specifications",
"specs": [
[
"==",
"2024.10.1"
]
]
},
{
"name": "jupyter_client",
"specs": [
[
"==",
"8.6.3"
]
]
},
{
"name": "jupyter_core",
"specs": [
[
"==",
"5.7.2"
]
]
},
{
"name": "jupyterlab_pygments",
"specs": [
[
"==",
"0.3.0"
]
]
},
{
"name": "keyring",
"specs": [
[
"==",
"25.4.1"
]
]
},
{
"name": "loguru",
"specs": [
[
"==",
"0.7.3"
]
]
},
{
"name": "logzero",
"specs": [
[
"==",
"1.7.0"
]
]
},
{
"name": "Markdown",
"specs": [
[
"==",
"3.7"
]
]
},
{
"name": "markdown-it-py",
"specs": [
[
"==",
"3.0.0"
]
]
},
{
"name": "MarkupSafe",
"specs": [
[
"==",
"2.1.5"
]
]
},
{
"name": "matplotlib-inline",
"specs": [
[
"==",
"0.1.7"
]
]
},
{
"name": "mdurl",
"specs": [
[
"==",
"0.1.2"
]
]
},
{
"name": "mistune",
"specs": [
[
"==",
"3.0.2"
]
]
},
{
"name": "mock",
"specs": [
[
"==",
"5.1.0"
]
]
},
{
"name": "more-itertools",
"specs": [
[
"==",
"10.3.0"
]
]
},
{
"name": "mss",
"specs": [
[
"==",
"6.1.0"
]
]
},
{
"name": "nbclient",
"specs": [
[
"==",
"0.10.2"
]
]
},
{
"name": "nbconvert",
"specs": [
[
"==",
"7.16.4"
]
]
},
{
"name": "nbformat",
"specs": [
[
"==",
"5.10.4"
]
]
},
{
"name": "nh3",
"specs": [
[
"==",
"0.2.18"
]
]
},
{
"name": "numpy",
"specs": [
[
"==",
"1.26.4"
]
]
},
{
"name": "opencv-contrib-python",
"specs": [
[
"==",
"4.5.5.64"
]
]
},
{
"name": "opencv-python",
"specs": [
[
"==",
"4.5.5.64"
]
]
},
{
"name": "packaging",
"specs": [
[
"==",
"24.1"
]
]
},
{
"name": "pandocfilters",
"specs": [
[
"==",
"1.5.1"
]
]
},
{
"name": "parso",
"specs": [
[
"==",
"0.8.4"
]
]
},
{
"name": "pickleshare",
"specs": [
[
"==",
"0.7.5"
]
]
},
{
"name": "pillow",
"specs": [
[
"==",
"10.4.0"
]
]
},
{
"name": "pipreqs",
"specs": [
[
"==",
"0.5.0"
]
]
},
{
"name": "pkginfo",
"specs": [
[
"==",
"1.10.0"
]
]
},
{
"name": "platformdirs",
"specs": [
[
"==",
"4.2.2"
]
]
},
{
"name": "prompt_toolkit",
"specs": [
[
"==",
"3.0.48"
]
]
},
{
"name": "psutil",
"specs": [
[
"==",
"6.0.0"
]
]
},
{
"name": "pure_eval",
"specs": [
[
"==",
"0.2.3"
]
]
},
{
"name": "py",
"specs": [
[
"==",
"1.11.0"
]
]
},
{
"name": "pydantic",
"specs": [
[
"==",
"2.9.2"
]
]
},
{
"name": "pydantic_core",
"specs": [
[
"==",
"2.23.4"
]
]
},
{
"name": "Pygments",
"specs": [
[
"==",
"2.18.0"
]
]
},
{
"name": "python-dateutil",
"specs": [
[
"==",
"2.9.0.post0"
]
]
},
{
"name": "pywin32-ctypes",
"specs": [
[
"==",
"0.2.3"
]
]
},
{
"name": "pywinauto",
"specs": [
[
"==",
"0.6.3"
]
]
},
{
"name": "pyzmq",
"specs": [
[
"==",
"26.2.0"
]
]
},
{
"name": "readme_renderer",
"specs": [
[
"==",
"44.0"
]
]
},
{
"name": "recommonmark",
"specs": [
[
"==",
"0.7.1"
]
]
},
{
"name": "referencing",
"specs": [
[
"==",
"0.35.1"
]
]
},
{
"name": "requests",
"specs": [
[
"==",
"2.32.3"
]
]
},
{
"name": "requests-toolbelt",
"specs": [
[
"==",
"1.0.0"
]
]
},
{
"name": "retry",
"specs": [
[
"==",
"0.9.2"
]
]
},
{
"name": "rfc3986",
"specs": [
[
"==",
"2.0.0"
]
]
},
{
"name": "rich",
"specs": [
[
"==",
"13.9.1"
]
]
},
{
"name": "rpds-py",
"specs": [
[
"==",
"0.22.3"
]
]
},
{
"name": "rstcheck",
"specs": [
[
"==",
"6.2.4"
]
]
},
{
"name": "rstcheck-core",
"specs": [
[
"==",
"1.2.1"
]
]
},
{
"name": "shellingham",
"specs": [
[
"==",
"1.5.4"
]
]
},
{
"name": "simple-tornado",
"specs": [
[
"==",
"0.2.2"
]
]
},
{
"name": "simplejson",
"specs": [
[
"==",
"3.19.3"
]
]
},
{
"name": "six",
"specs": [
[
"==",
"1.16.0"
]
]
},
{
"name": "snowballstemmer",
"specs": [
[
"==",
"2.2.0"
]
]
},
{
"name": "soupsieve",
"specs": [
[
"==",
"2.6"
]
]
},
{
"name": "Sphinx",
"specs": [
[
"==",
"7.4.7"
]
]
},
{
"name": "sphinx-markdown-tables",
"specs": [
[
"==",
"0.0.17"
]
]
},
{
"name": "sphinx-rtd-theme",
"specs": [
[
"==",
"3.0.1"
]
]
},
{
"name": "sphinxcontrib-applehelp",
"specs": [
[
"==",
"2.0.0"
]
]
},
{
"name": "sphinxcontrib-devhelp",
"specs": [
[
"==",
"2.0.0"
]
]
},
{
"name": "sphinxcontrib-htmlhelp",
"specs": [
[
"==",
"2.1.0"
]
]
},
{
"name": "sphinxcontrib-jquery",
"specs": [
[
"==",
"4.1"
]
]
},
{
"name": "sphinxcontrib-jsmath",
"specs": [
[
"==",
"1.0.1"
]
]
},
{
"name": "sphinxcontrib-qthelp",
"specs": [
[
"==",
"2.0.0"
]
]
},
{
"name": "sphinxcontrib-serializinghtml",
"specs": [
[
"==",
"2.0.0"
]
]
},
{
"name": "stack-data",
"specs": [
[
"==",
"0.6.3"
]
]
},
{
"name": "tabulate",
"specs": [
[
"==",
"0.9.0"
]
]
},
{
"name": "tidevice",
"specs": [
[
"==",
"0.12.10"
]
]
},
{
"name": "tinycss2",
"specs": [
[
"==",
"1.4.0"
]
]
},
{
"name": "tomli",
"specs": [
[
"==",
"2.0.1"
]
]
},
{
"name": "tornado",
"specs": [
[
"==",
"6.4.2"
]
]
},
{
"name": "traitlets",
"specs": [
[
"==",
"5.14.3"
]
]
},
{
"name": "twine",
"specs": [
[
"==",
"5.1.1"
]
]
},
{
"name": "typer",
"specs": [
[
"==",
"0.13.0"
]
]
},
{
"name": "typing_extensions",
"specs": [
[
"==",
"4.12.2"
]
]
},
{
"name": "urllib3",
"specs": [
[
"==",
"2.2.3"
]
]
},
{
"name": "wcwidth",
"specs": [
[
"==",
"0.2.13"
]
]
},
{
"name": "webencodings",
"specs": [
[
"==",
"0.5.1"
]
]
},
{
"name": "win32_setctime",
"specs": [
[
"==",
"1.2.0"
]
]
},
{
"name": "wrapt",
"specs": [
[
"==",
"1.16.0"
]
]
},
{
"name": "yarg",
"specs": [
[
"==",
"0.1.9"
]
]
},
{
"name": "zipp",
"specs": [
[
"==",
"3.19.2"
]
]
}
],
"lcname": "autopc"
}