UIAutomator 是一个非常棒的工具,可用于执行 Android UI 测试,但要使用它,您必须编写 Java 代码,编译代码,安装 jar 文件……
UIAutomator 是一个非常棒的工具,可用于执行 Android UI 测试,但要使用它,您必须编写 Java 代码,编译代码,安装 jar 文件……
UIAutomator is a great tool to perform Android UI testing, but to do it, you have to write java code, compile it, install the jar, and run. It's a complex steps for all testers...
This project is to build a light weight jsonrpc server in Android device, so that we can just write PC side script to write UIAutomator tests.
$ ./gradlew build
$ ./gradlew packageDebugAndroidTest$ ./gradlew cC
$ adb forward tcp:9008 tcp:9008 # tcp forwardIf debug apk already installed, There is no need to use gradle.
simply run the following command
adb forward tcp:9008 tcp:9008
adb shell am instrument -w -r -e debug false -e class com.github.uiautomator.stub.Stub \
com.github.uiautomator.test/androidx.test.runner.AndroidJUnitRunner$ curl -X POST -d '{"jsonrpc": "2.0", "id": "1f0f2655716023254ed2b57ba4198815", "method": "deviceInfo", "params": {}}' 'http://127.0.0.1:9008/jsonrpc/0'
{'currentPackageName': 'com.smartisanos.launcher',
'displayHeight': 1920,
'displayRotation': 0,
'displaySizeDpX': 360,
'displaySizeDpY': 640,
'displayWidth': 1080,
'productName': 'surabaya',
'screenOn': True,
'sdkInt': 23,
'naturalOrientation': True}Clipboard, Thanks to @fplust
com.github.uiautomator/.AdbKeyboard
Encode the text into UTF-8 and then Base64
For example:
"Hello 你好" -> (UTF-8 && Base64) = SGVsbG8g5L2g5aW9Send to AdbKeyboard with broadcast
Broadcast completed: result=-1 means success
…You can change mock location from terminal using adb in order to test GPS on real devices.
adb [-s ] shell am broadcast -a send.mock [-e lat ] [-e lon ]
[-e alt ] [-e accurate ]For example:
adb shell am broadcast -a send.mock -e lat 15.3 -e lon 99adb shell am start -n com.github.uiautomator/.ToastActivity -e message helloadb shell am start -n com.github.uiautomator/.ToastActivity -e showFloatWindow true # show
adb shell am start -n com.github.uiautomator/.ToastActivity -e showFloatWindow false # hideimport uiautomator2 as u2
d = u2.connect()
d.screen.on()
d(text="Settings").click()
d(scrollable=True).scroll.vert.forward()Refer to python wrapper library uiautomator.
npm install -g conventional-changelog-cli
conventional-changelog -p grunt -i CHANGELOG.md -s -r 0If you have any idea, please email [email protected] or submit tickets.
暂无开放 Issues,或尚未同步最近议题。