文章目录 [隐藏]
参考,https://testerhome.com/topics/11357
似乎还在开发阶段不够完善。
黑产,灰产,群控,刷量
一.Adb准备
仅使用adb程序,不必完全下载sdk。配置到环境变量。略。
二.Python3准备
1.安装brew
1 |
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" |
2.验证Mac已有python
1 2 3 4 5 6 |
$ python Python 2.7.10 (default, Aug 17 2018, 19:45:58) [GCC 4.2.1 Compatible Apple LLVM 10.0.0 (clang-1000.0.42)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> |
退出pythonshell
1 |
>>> exit() |
3.安装python3
1 2 |
$ brew install python3 |
查看指令目录
1 2 |
$ which python3 /usr/local/bin/python3 |
三.UiAutomator2准备
1 2 3 |
$ pip3 install --pre -U uiautomator2 $ pip3 install pillow |
四.手机准备(USB连接,可以多个手机)
1 2 3 4 5 6 7 8 |
$ python3 -m uiautomator2 init $ python3 >>> import uiautomator2 as u2 device = u2.connect('192.168.1.102') print(device.info) {'currentPackageName': 'com.github.uiautomator', 'displayHeight': 1208, 'displayRotation': 0, 'displaySizeDpX': 360, 'displaySizeDpY': 640, 'displayWidth': 720, 'productName': 'DIG-AL00', 'screenOn': True, 'sdkInt': 23, 'naturalOrientation': True} |
五.网页版uiautomatorviewer工具weditor
1 2 |
$ pip3 install --pre --upgrade weditor $ python3 -m weditor |
这时自动启动默认浏览器打开 http://localhost:17310/
在第五步连接手机时各种错误,都是提示python代码错误。各种重复前面4个大步骤,稀里糊涂解决了。
解决办法看起来是这样的,每次测试都这么操作:
首先:USB连接设备,执行 python3 -m uiautomator2 init ,
然后:可以断开USB连接了,执行 python3 -m weditor 。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/weditor/web/handlers/page.py", line 143, in post id = connect_device(platform, device_url) File "/usr/local/lib/python3.7/site-packages/weditor/web/device.py", line 69, in connect_device d = _AndroidDevice(device_url) File "/usr/local/lib/python3.7/site-packages/weditor/web/device.py", line 10, in __init__ d = u2.connect(device_url) File "/usr/local/lib/python3.7/site-packages/uiautomator2/__init__.py", line 119, in connect return connect_usb(addr) File "/usr/local/lib/python3.7/site-packages/uiautomator2/__init__.py", line 159, in connect_usb lport = device.forward_port(7912) File "/usr/local/lib/python3.7/site-packages/adbutils/__init__.py", line 358, in forward_port self._client.forward(self._serial, "tcp:" + str(local_port), remote) File "/usr/local/lib/python3.7/site-packages/adbutils/__init__.py", line 227, in forward c.check_okay() File "/usr/local/lib/python3.7/site-packages/adbutils/__init__.py", line 137, in check_okay raise AdbError(self.read_string()) adbutils.errors.AdbError: device '192.108.1.102' not found |
end
声明
本文由崔维友 威格灵 cuiweiyou vigiles cuiweiyou 原创,转载请注明出处:http://www.gaohaiyan.com/2338.html
承接App定制、企业web站点、办公系统软件 设计开发,外包项目,毕设