UiAutomator2.0相关收集

本文集合了多个关于UIautomator2的实用教程和技术博文,深入介绍了UIautomator2的各种类如UiObject2、BySelector、UiWatcher等的使用方法,并提供了丰富的实例,帮助读者快速掌握Android自动化测试技巧。

UIautomator2填坑点击打开链接

UIautomator2 API概述 http://blog.youkuaiyun.com/java18/article/details/53535928

UIautomator2使用实例及使用CTS   http://www.cnblogs.com/zeo-to-one/p/8245732.html

基于UIAutomator+Jenkins Android自动化测试 实现 http://blog.youkuaiyun.com/stonree/article/details/25404125


Uiautomator 2.0之UiObject2类学习小记  http://blog.youkuaiyun.com/swordgirl2011/article/details/50993157


Uiautomator 2.0之BySelector类学习小记 http://blog.youkuaiyun.com/swordgirl2011/article/details/50990584


Uiautomator 2.0之UiWatcher类学习小记 http://blog.youkuaiyun.com/swordgirl2011/article/details/51010683


Uiautomator 2.0之UiDevice新增API学习小记  http://blog.youkuaiyun.com/swordgirl2011/article/details/50941555


Uiautomator 2.0之Until类学习小记  http://blog.youkuaiyun.com/swordgirl2011/article/details/50992135







Message: An unknown server-side error occurred while processing the command. Original error: 'POST /actions' cannot be proxied to UiAutomator2 server because the instrumentation process is not running (probably crashed). Check the server log and/or the logcat output for more details Stacktrace: UnknownError: An unknown server-side error occurred while processing the command. Original error: 'POST /actions' cannot be proxied to UiAutomator2 server because the instrumentation process is not running (probably crashed). Check the server log and/or the logcat output for more details at UIA2Proxy.command (C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\appium-base-driver\lib\jsonwp-proxy\proxy.js:274:13) at runMicrotasks (<anonymous>) at processTicksAndRejections (internal/process/task_queues.js:85:5) Traceback: File "D:\Hy_autotests\Hy_autotest\cases\Supperapp\Amap\Super_Amap_001.py", line 54, in teststeps self.super.swipe_down(self.driver) File "D:\Hy_autotests\Hy_autotest\lib\ThirdApp\superapp_common.py", line 442, in swipe_down driver.swipe(x1, y1, x2, y2, duration) File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\appium\webdriver\extensions\action_helpers.py", line 158, in swipe actions.perform() File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium\webdriver\common\action_chains.py", line 78, in perform self.w3c_actions.perform() File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium\webdriver\common\actions\action_builder.py", line 88, in perform self.driver.execute(Command.W3C_ACTIONS, enc) File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 429, in execute self.error_handler.check_response(response) File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\appium\webdriver\errorhandler.py", line 30, in check_response raise wde File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\appium\webdriver\errorhandler.py", line 26, in check_response super().check_response(response) File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 243, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: 'POST /actions' cannot be proxied to UiAutomator2 server because the instrumentation process is not running (probably crashed). Check the server log and/or the logcat output for more details Stacktrace: UnknownError: An unknown server-side error occurred while processing the command. Original error: 'POST /actions' cannot be proxied to UiAutomator2 server because the instrumentation process is not running (probably crashed). Check the server log and/or the logcat output for more details at UIA2Proxy.command (C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\appium-base-driver\lib\jsonwp-proxy\proxy.js:274:13) at runMicrotasks (<anonymous>) at processTicksAndRejections (internal/process/task_queues.js:85:5)
07-25
[2025-11-11 10:01:06.632] INFO [30772] [CID:Bsp_Storage_defrag_0007] <Bsp_Storage_defrag_0007.py:59> 第121次执行接口,修改时间为24h之后便于多次触发 [2025-11-11 10:01:07.674] INFO [30772] [CID:Bsp_Storage_defrag_0007] <common.py:669> dt_modify:2025-11-16 [2025-11-11 10:01:07.674] INFO [30772] [CID:Bsp_Storage_defrag_0007] <common.py:670> modify_sys_time()-> from 2025-11-15 to 2025-11-16 [2025-11-11 10:01:08.737] INFO [30772] [CID:Bsp_Storage_defrag_0007] <common.py:674> output:2025-11-11 [2025-11-11 10:01:09.100] INFO [32156] [CID:Bsp_Storage_defrag_0007] <phone_base.py:1057> screenshot ok,use 0.32s,image name:script_frame_png@wrapper.TestModuleAwLogicIssue@3K6596001HD00000@1762826468775@Bsp_Storage_defrag_0007@null [2025-11-11 10:01:09.323] INFO [32156] [CID:Bsp_Storage_defrag_0007] <grpc_base.py:612> device_id:3K6596001HD00000, Apk android.camera.cts is installed already [2025-11-11 10:01:09.324] INFO [32156] [CID:Bsp_Storage_defrag_0007] <__init__.py:289> current uiautomator version 3.4.2 [2025-11-11 10:01:09.561] INFO [32156] [CID:Bsp_Storage_defrag_0007] <__init__.py:402> forward tcp:57802 tcp:9008 [2025-11-11 10:01:09.575] ERROR [32156] [CID:Bsp_Storage_defrag_0007] <__init__.py:261> sn:3K6596001HD00000 POST->url:http://127.0.0.1:forward:57802to9008/jsonrpc/0 param:{'data': '{"jsonrpc": "2.0", "id": "ping", "method": "ping"}', 'json': None, 'timeout': 3},request error: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response')) [2025-11-11 10:01:09.657] INFO [32156] [CID:Bsp_Storage_defrag_0007] <__init__.py:335> current uiautomator running info: [2025-11-11 10:01:10.739] ERROR [32156] [CID:Bsp_Storage_defrag_0007] <__init__.py:261> sn:3K6596001HD00000 POST->url:http://127.0.0.1:forward:57802to9008/jsonrpc/0 param:{'data': '{"jsonrpc": "2.0", "id": "ping", "method": "ping"}', 'json': None, 'timeout': 3},request error: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response')) [2025-11-11 10:01:10.753] INFO [32156] [CID:Bsp_Storage_defrag_0007] <__init__.py:393> forward tcp:57811 tcp:7920 [2025-11-11 10:01:10.769] ERROR [32156] [CID:Bsp_Storage_defrag_0007] <__init__.py:261> sn:3K6596001HD00000 GET->url:http://127.0.0.1:forward:57811to7920/uiautomator param:{'allow_redirects': True},request error: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response')) [2025-11-11 10:01:10.770] WARNING [32156] [CID:Bsp_Storage_defrag_0007] <__init__.py:264> atx-instrument has something wrong, auto recovering [2025-11-11 10:01:10.784] ERROR [32156] [CID:Bsp_Storage_defrag_0007] <__init__.py:261> sn:3K6596001HD00000 POST->url:http://127.0.0.1:forward:57802to9008/jsonrpc/0 param:{'data': '{"jsonrpc": "2.0", "id": "ping", "method": "ping"}', 'json': None, 'timeout': 3},request error: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response')) [2025-11-11 10:01:10.799] ERROR [32156] [CID:Bsp_Storage_defrag_0007] <__init__.py:261> sn:3K6596001HD00000 POST->url:http://127.0.0.1:forward:57802to9008/jsonrpc/0 param:{'data': '{"jsonrpc": "2.0", "id": "ping", "method": "ping"}', 'json': None, 'timeout': 3},request error: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response')) [2025-11-11 10:01:11.069] INFO [32156] [CID:Bsp_Storage_defrag_0007] <init.py:598> init Install [2025-11-11 10:01:11.171] INFO [32156] [CID:Bsp_Storage_defrag_0007] <init.py:654> No process matching atx-instrument found. [2025-11-11 10:01:11.310] INFO [32156] [CID:Bsp_Storage_defrag_0007] <phone_base.py:175> AtxAppQueryController query state: [2025-11-11 10:01:13.053] INFO [32156] [CID:Bsp_Storage_defrag_0007] <grpc_base.py:612> device_id:3K6596001HD00000, Apk android.camera.cts is installed already [2025-11-11 10:01:18.624] INFO [32156] [CID:Bsp_Storage_defrag_0007] <grpc_base.py:612> device_id:3K6596001HD00000, Apk com.oplus.autotest.olib.uiautomator is installed already [2025-11-11 10:01:18.624] INFO [32156] [CID:Bsp_Storage_defrag_0007] <phone_base.py:195> apk:OlibOplusAtx,package install com.oplus.autotest.olib.uiautomator install state:True [2025-11-11 10:01:19.042] INFO [32156] [CID:Bsp_Storage_defrag_0007] <init.py:585> Install atx-instrument 0.0.8 [2025-11-11 10:01:19.045] INFO [32156] [CID:Bsp_Storage_defrag_0007] <init.py:119> url:http://maven.scm.adc.com:8081/nexus/repository/olib-shares/other/bin/atx/0.0.8/atx-instrument_linux_arm64,path:D:\Users\18915215633\.uiautomator2\cache\atx-instrument_linux_arm64-da8d61b8f6\atx-instrument_linux_arm64 [2025-11-11 10:01:19.885] INFO [32156] [CID:Bsp_Storage_defrag_0007] <init.py:671> /data/local/tmp/atx-instrument server --nouia -d --atxPkg com.oplus.autotest.olib.uiautomator --class androidx.test.runner.AndroidJUnitRunner --testPkg com.oplus.autotest.olib.uiautomator runoutput:INFO[0000] run atx-instrument in background 0.0.8 INFO[0000] atx-instrument listening on :7920 [2025-11-11 10:01:19.901] ERROR [32156] [CID:Bsp_Storage_defrag_0007] <init.py:684> ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response')) [2025-11-11 10:01:21.117] ERROR [32156] [CID:Bsp_Storage_defrag_0007] <__init__.py:261> sn:3K6596001HD00000 POST->url:http://127.0.0.1:forward:57802to9008/jsonrpc/0 param:{'data': '{"jsonrpc": "2.0", "id": "ping", "method": "ping"}', 'json': None, 'timeout': 3},request error: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response')) [2025-11-11 10:01:23.183] WARNING [32156] [CID:Bsp_Storage_defrag_0007] <__init__.py:455> _prepare_atx_instrument out lock, use time:12.383s [2025-11-11 10:01:24.054] ERROR [32144] [CID:Bsp_Storage_defrag_0007] <tc.py:1493> 测试模块aw/logic问题:Fail to modify system time for phone! [2025-11-11 10:01:24.055] ERROR [32144] [CID:Bsp_Storage_defrag_0007] <tc.py:1507> Traceback (most recent call last): File "E:\olib_docker_64\25111109323000_32288\Python37\site-packages\olib\tc.py", line 2041, in exe_case_body self.exe_main(case_name) File "E:\olib_docker_64\25111109323000_32288\Python37\site-packages\olib\tc.py", line 2023, in exe_main args=(self.mark_log_point_loader(getattr(self, case_name)),)) File "E:\olib_docker_64\25111109323000_32288\Python37\site-packages\olib\olib_timeout.py", line 101, in func_timeout raise_exception(exception) File "C:\olib\python37\lib\site-packages\func_timeout\py3_raise.py", line 7, in raise_exception raise exception[0] from None File "E:\olib_docker_64\25111109323000_32288\Python37\site-packages\olib\tc.py", line 136, in fix_timeout func(*args, **kwargs) File "E:\olib_docker_64\25111109323000_32288\Python37\site-packages\olib\tc.py", line 1073, in wrapper value = func(*args, **kwargs) File "E:\olib_docker_64\25111109323000_32288\Python37\site-packages\olib_aw\teams\bsp\storage\common.py", line 844, in wrapper func(instance, *args, **kwargs) File "E:\olib_docker_64\25111109323000_32288\Python37\site-packages\olib_scripts_oplus_bsp\scripts\bsp\storage\storage_defrag\Bsp_Storage_defrag_0007.py", line 60, in main modify_sys_time_by_hours(self.dut, hours=25) File "E:\olib_docker_64\25111109323000_32288\Python37\site-packages\olib_aw\teams\bsp\common.py", line 676, in modify_sys_time_by_hours raise TestModuleAwLogicIssue("Fail to modify system time for phone!") olib.olib_except.script_except.TestModuleAwLogicIssue: 测试模块aw/logic问题:Fail to modify system time for phone! [2025-11-11 10:01:24.090] INFO [22612] [CID:Bsp_Storage_defrag_0007] <phone_base.py:1219> device_id:3K6596001HD00000, reuse phone object. [2025-11-11 10:01:24.090] INFO [22612] [CID:Bsp_Storage_defrag_0007] <tc_utils.py:240> start device_point [2025-11-11 10:01:24.618] INFO [32664] [CID:Bsp_Storage_defrag_0007] <phone_base.py:1057> screenshot ok,use 0.22s,image name:script_step@wrapper@3K6596001HD00000@1762826484398@Bsp_Storage_defrag_0007@null [2025-11-11 10:01:24.743] INFO [14736] [CID:Bsp_Storage_defrag_0007] <tc.py:1058> Entering .Bsp_Storage_defrag_0007.cleanup_iteration [2025-11-11 10:01:24.743] INFO [14736] [CID:Bsp_Storage_defrag_0007] <tc.py:1075> Exiting .Bsp_Storage_defrag_0007.cleanup_iteration [2025-11-11 10:01:24.745] INFO [26248] [CID:Bsp_Storage_defrag_0007] <tc.py:1058> Entering .Bsp_Storage_defrag_0007.cleanup_testcase [2025-11-11 10:01:24.745] INFO [26248] [CID:Bsp_Storage_defrag_0007] <tc.py:1075> Exiting .Bsp_Storage_defrag_0007.cleanup_testcase [2025-11-11 10:01:24.745] INFO [32144] [CID:Bsp_Storage_defrag_0007] <tc.py:1733> 处理用例log [2025-11-11 10:01:24.746] INFO [32144] [CID:Bsp_Storage_defrag_0007] <tc.py:3343> current disk free space : 185G; [2025-11-11 10:01:24.819] INFO [32144] [CID:Bsp_Storage_defrag_0007] <tc.py:2490> start-copy c:\olib\logs\3656885_251111093211_11036\Bsp_Storage_defrag_0007_14997949_38955632 to D:\gtest-cli\execute-agent\home\tmp\script-38955632-424\OLIB-r0--0-0\0\Bsp_Storage_defrag_0007_14997949_38955632
11-12
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值