{"id":13625969,"url":"https://github.com/NetEaseGame/ATX","last_synced_at":"2025-04-16T11:31:00.332Z","repository":{"id":46593330,"uuid":"52533029","full_name":"NetEaseGame/ATX","owner":"NetEaseGame","description":"Smart phone automation tool. Support iOS, Android, WebApp and game.","archived":true,"fork":false,"pushed_at":"2019-03-01T03:54:36.000Z","size":6622,"stargazers_count":1589,"open_issues_count":35,"forks_count":425,"subscribers_count":118,"default_branch":"master","last_synced_at":"2025-03-15T07:39:12.773Z","etag":null,"topics":["android","atx","ios","python","test-automation"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NetEaseGame.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-02-25T14:54:35.000Z","updated_at":"2025-03-13T03:37:08.000Z","dependencies_parsed_at":"2022-07-20T05:47:42.177Z","dependency_job_id":null,"html_url":"https://github.com/NetEaseGame/ATX","commit_stats":null,"previous_names":["codeskyblue/airtestx"],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NetEaseGame%2FATX","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NetEaseGame%2FATX/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NetEaseGame%2FATX/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NetEaseGame%2FATX/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NetEaseGame","download_url":"https://codeload.github.com/NetEaseGame/ATX/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249235033,"owners_count":21235133,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","atx","ios","python","test-automation"],"created_at":"2024-08-01T21:02:06.752Z","updated_at":"2025-04-16T11:30:59.740Z","avatar_url":"https://github.com/NetEaseGame.png","language":"Python","readme":"# ATX(AutomatorX) (中文版)\n[![Build Status](https://travis-ci.org/NetEaseGame/ATX.svg?branch=master)](https://travis-ci.org/NetEaseGame/ATX)\n[![Documentation Status](https://readthedocs.org/projects/atx/badge/?version=latest)](http://atx.readthedocs.org/en/latest/?badge=latest)\n[![PyPI](https://img.shields.io/pypi/v/atx.svg)](https://pypi.python.org/pypi/atx)\n[![PyPI](https://img.shields.io/pypi/l/atx.svg)]()\n[![Gitter](https://badges.gitter.im/codeskyblue/ATX.svg)](https://gitter.im/codeskyblue/ATX?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge)\n\n## 重要说明 ！！！\n\nATX目前已经分成了两个项目\n\n- 安卓(Android) https://github.com/openatx/uiautomator2  简称u2\n- 苹果(iOS) https://github.com/openatx/facebook-wda\n\n旧项目不再维护。欢迎入群讨论 QQ: `499563266`\n\n## Introduction (简介)\nATX(AutomatorX) 是一款开源的自动化测试工具，支持测试iOS平台和Android平台的原生应用、游戏、Web应用。\n使用Python来编写测试用例，混合使用图像识别，控件定位技术来完成游戏的自动化。附加专用的IDE来完成脚本的快速编写。\n\n## Hope (愿景)\n希望该项目可以让手机应用测试自动化起来，让测试人员摆脱那些枯燥的重复性工作。\n\n## 重要说明\n新版本以采用新的uiautomator2替换到原来的[atx-uiautomator](https://github.com/openatx/atx-uiautomator). 历史版本可以通过Tag查看[tag:1.1.3](https://github.com/NetEaseGame/ATX/tree/1.1.3)\n测试安卓应用前，需要先进行init操作\n\n```\npython -muiautomator2 init\n```\n\n用于安卓和iOS原生应用测试的库已经分离出来，可以单独使用（强烈推荐单独使用，一来依赖少、稳定性高，二来写代码的时候还能自动补全）\n\n1. 对于Android应用的测试，如果不需要用到图像识别，推荐使用这个项目[uiautomator2](https://github.com/openatx/uiautomator2)\n1. 对于iOS应用的测试，如果不需要用到图像识别，推荐使用这个项目[facebook-wda](https://github.com/openatx/facebook-wda)\n\nBTW: atx-webide已经不在维护\n\n## Features\n- [x] 支持iOS, Android 双平台的原生应用，Web应用和游戏\n- [x] 支持通过图像识别来定位元素的位置\n- [x] 内置自动生成测试报告的功能\n- [x] 网页版的脚本编辑器，来帮助快速的写代码\n\n## Discuss (讨论群)\n面向游戏行业测试人员，当然也开放给国际友人(PS：中文不知道他们看得懂不)\n\n- QQ: `499563266` PS: 因为群人数即将到达上限，所以目前进群有收取少量的群费,来募集扩大群规模的费用。\n- ~~网易内部用户加Popo群 `1347390` 群主 `hzsunshx`~~\n- [Testerhome社区](https://testerhome.com/topics/node78)\n- ~~[Gitter Chat Room](https://gitter.im/codeskyblue/AutomatorX?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge)~~\n\n## Limitation (限制)\n- Python 2.7 or 3.6\n- Android 4.4+\n- iOS 9.0+ with Mac\n- adb \u003e= 1.0.36\n\n## Installation (安装)\n准备Python虚拟环境 [Virtualenv]((http://www.jianshu.com/p/08c657bd34f1))\n\n```bash\npip install virtualenv\nvirtualenv venv\n\n# Linux or Mac\n. venv/bin/activate\n\n# Windows\nvenv\\Scripts\\activate.bat \n```\n\n安装相关的python库\n\n```bash\n# install the lastest version of atx\n# If feed too slow use douban pypi mirror:  -i https://pypi.doubanio.com/simple/\npip install --upgrade --pre atx\n\n# install opencv dependencies\npip install opencv_contrib_python\n```\n\n**Android测试依赖**\n\n- ADB\n\n\t* [Windows adb安装指南](https://github.com/NetEase/AutomatorX/wiki/Win-Installation)\n\t* Mac上的adb可以通过命令行安装 `brew install android-platform-tools`\n\n- [ATX手机助手.apk](https://github.com/NetEaseGame/ATX/releases/download/1.0.12/atx-assistant-1.0.6.apk)\n\n\t该App为自动化提供了输入法的功能，屏幕常量等功能\n\t~~命令行安装 `python -m atx install atx-assistant`~~\n\n**iOS测试依赖**\n\n- WebDriverAgent\n\n\t由于WebDriverAgent更新过快，atx的一个依赖库[facebook-wda](https://github.com/openatx/facebook-wda)还跟不上他更新的速度，下载完WDA后，请切换到这个版本\n\n\t```\n\tgit reset --hard a8def24ca67f8a74dd709b899c8ea539c9c488ea\n\t```\n\n\t你的iPhone手机需要连接到Mac上，然后Mac安装[WebDriverAgent](https://github.com/facebook/WebDriverAgent)，通常对Xcode部署的人搭WDA的人会遇到不少问题，搞不定继续参考这里 \u003chttps://testerhome.com/topics/7220\u003e\n\n\tWDA成功启动后，会生成一个用于ATX连接的http地址，比如`http://localhost:8100`\n\n**检查安装是否成功**\n\n```bash\n# 查看atx版本号\npython -m atx version\n# 检查环境配置是否正常\npython -m atx doctor\n```\n\n**脚本编辑器**(可选)\n\n为了方便快速的写出脚本，提供了三个Web编辑器。\n\n- 自带GUI\n\n\t自带的使用Tkinter写的编辑器，只提供截图功能，但是比较稳定，启动方法 `python -m atx gui -s ${SERIAL or WDA_URL}`\n\t使用 `python -m atx gui -h` 可以查看更多的选项\n\n- [weditor](https://github.com/openatx/weditor) __beta__ 针对Android和iOS原生应用快速定位元素，自动生成代码\n\n## Getting Started （必看）\n* [快速入门文档](docs/QUICKSTART.md)\n* [~~如何使用内置的测试报告功能~~](atx/ext/report/README.md)\n* [ATX资料快速索引](https://testerhome.com/topics/9091)\n* [Testerhome上的ATX有关的文章列表](https://testerhome.com/topics/node78)\n\n内置的测试报告暂时有点问题，最近没时间去修复了。因为ATX底层使用的[uiautomator2](https://github.com/openatx/uiautomator2)，测试报告可以用底层库自带的 [SimpleHTMLReport](https://github.com/openatx/uiautomator2/tree/master/uiautomator2/ext/htmlreport)\n\n## APIs (接口文档)\n* [常用接口](docs/API.md)\n* [iOS的接口文档](https://testerhome.com/topics/7204)\n\n## Other (其他)\n* ATX自带的命令行工具 \u003chttps://github.com/NetEase/AutomatorX/wiki/Command-Line-Tools\u003e\n\n## Known Issues (常见问题)\nIf you are having some issues please checkout [wiki](https://github.com/NetEase/AutomatorX/wiki/Common-Issues) first.\n\n为了避免潜在的Python编码问题，代码文件都应该用UTF-8编码格式保存。\n\n- 测试中出现的弹窗如何处理？\n\n\t《iOS弹窗如何自动处理》，仅供参考 https://testerhome.com/topics/9540\n\n- 对于python2.7 字符串前应该加上u开头，例如`u'你好'`\n\n\t文件的开头可以加上下面这段代码，强制使用python3的编码体系(默认全部都是unicode)\n\n\t```python\n\tfrom __future__ import unicode_literals\n\t```\n\n- 对于python3的非windows系统\n\t\n\t检查一下`sys.stdout.encoding`的编码是否是UTF-8，不然中文字符的输出通常会有问题\n\t解决办法通常就是在bashrc文件中加入一行\n\n\t```shell\n\texport PYTHONIOENCODING=UTF-8\n\t```\n\n## ATX Extentions （扩展功能）\n* WebView\n\n\t目前仅限安卓, 具体参考 \u003chttps://testerhome.com/topics/7232\u003e\n\n\t例子代码\n\n\t```python\n\t# coding: utf-8\n\timport atx\n\tfrom atx.ext.chromedriver import ChromeDriver\n\n    d = atx.connect()\n    driver = ChromeDriver(d).driver() # return selenium.driver instance\n    elem = driver.find_element_by_link_text(u\"登录\")\n    elem.click()\n    driver.quit()\n    ```\n\n    PS: 实现这个扩展并不复杂，简单的封装了一下selenium就搞定了\n\n* Performance record (For Android)\n\t\n\t性能测试直接使用了腾讯开源的[GT](http://gt.qq.com/)\n\n\tPS: 刚写好没多久，你只能在最新的开发版中看到。有可能以后还会修改。\n\n\t使用方法\n\n\t1. 首先需要去腾讯GT的主页上，将GT安装到手机上\n\n\t\t\u003chttp://gt.qq.com\u003e\n\n\t2. 代码中引入GT扩展\n\n\t\t```python\n\t\timport atx\n\t\tfrom atx.ext.gt import GT\n\n\n\t\td = atx.connect()\n\n\t\tgt = GT(d)\n\t\tgt.start_test('com.netease.my') # start test\n\t\t# ... do click touch test ...\n\t\tgt.stop_and_save()\n\t\t```\n\n\t3. 运行完测试后，代码会保存到`/sdcard/GT/GW/`+`包名(com.netease.my)`目录下，直接使用`adb pull`下载下来并解析\n\n\t\t```\n\t\t$ adb pull /sdcard/GT/GW/com.netease.my/\n\t\t```\n\n\t该部分代码位于 [atx/ext/gt.py](atx/ext/gt.py), 这部分代码目前在我看来，易用性一般般，希望使用者能根据具体情况，进行修改，如果是修改具有通用性，欢迎提交PR，我们会负责Review代码。\n\n## 代码导读\n`connect` 函数负责根据平台返回相应的类(`atx.drivers.android.AndroidDevice` or `atx.drivers.ios_webdriveragent.IOSDevice`)\n\n图像识别依赖于另一个库 [aircv](https://github.com/netease/aircv), 虽然这个库还不怎么稳定，也还凑合能用吧\n\n每个平台相关的库都放到了 目录 `atx/device`下，公用的方法在`atx/device/device_mixin.py`里实现。第三方扩展位于`atx/ext`目录下。\n\n## Related projects (相关的项目)\n1. 基于opencv的图像识别库 \u003chttps://github.com/netease/aircv\u003e\n2. 感谢作者 \u003chttps://github.com/xiaocong\u003e 提供的uiautomator的python封装，相关项目已经fork到了\n\n\t- \u003chttps://github.com/codeskyblue/android-uiautomator-server\u003e\n\t- \u003chttps://github.com/codeskyblue/atx-uiautomator\u003e\n3. Android input method \u003chttps://github.com/macacajs/android-unicode\u003e\n3. SikuliX \u003chttp://sikulix-2014.readthedocs.org/en/latest/index.html\u003e\n4. Blockly \u003chttps://github.com/codeskyblue/blockly\u003e\n\n## Contribution (参与贡献)\n如何才能让软件变的更好，这其中也一定需要你的参与才行，发现问题去在github提个issue, 一定会有相应的开发人员看到并处理的。文档有错误的话，直接提Issue，或者提PR都可以。\n由于我平常使用该项目的概率并不怎么高，所有不少问题即使存在我也不会发现，请养成看到问题提Issue的习惯，所有的Issue我都会去处理的，即使当时处理不了，等技术成熟了，我还是会处理。但是如果不提交Issue，说不定我真的会忘掉。\n\nBTW: 有开发能力的也可以先跟开发者讨论下想贡献的内容，并提相应的PR由开发人员审核。\n\n## License (协议)\nThis project is under the Apache 2.0 License. See the [LICENSE](LICENSE) file for the full license text.\n\n","funding_links":[],"categories":["自动化工具","Python","自动化测试"],"sub_categories":["AppUI自动化"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FNetEaseGame%2FATX","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FNetEaseGame%2FATX","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FNetEaseGame%2FATX/lists"}