自动化测试 appium 会报错 Could not proxy command to remote server. Original error: Error: socket hang up

问题描述:

最近使用vivo X21A进行APP自动化测试过程中,发现程序运行过程中突然中断,查看报错信息 Error: socket hang up。appium 自动化测试,运行平台 vivo X21A真机驱动框架 UiAutomator2现象自动化代码在vivo手机上运行一段时间之后,appium 会报错 Could not proxy command to remote server. Original error: Error: socket hang up

原因分析:

appium日志

  1. [debug] [W3C (9ae907c5)] Encountered internal error running command:UnknownError: An unknown server-side error occurred while processing the command. Original error: Could not proxy command to remote server. Original error: Error: socket hang up
  2. [debug] [W3C(9ae907c5)]at JWProxy.command(/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/jsonwp-proxy/proxy.js:261:13)
  3. [HTTP] <-- POST /wd/hub/session/9ae907c5-5319-4f0b-92dc-fdaa47cfdcc5/element 500 139ms - 530

解决方案:

尝试下列方法,但是无效:

卸载重装vivo手机上的appium 驱动应用,包括如下几个:

  • io.appium.settings
  • io.appium.uiautomator2.server
  • io.appium.uiautomator2.server.test

Logcat抓手机日志发现问题

02-29 09:43:32.216 28683 28944 I appium : Waiting up to 10000ms for device to be idle
02-29 09:43:32.236 1742 15589 I ActivityManager: Force stopping io.appium.uiautomator2.server appid=10271 user=0: stop by com.vivo.abe
02-29 09:43:32.236 701 701 E ANDR-IOP: IOP HAL: Received pkg_name = io.appium.uiautomator2.server pid = 0
02-29 09:43:32.237 1742 15589 I ActivityManager: Killing 28683:io.appium.uiautomator2.server/u0a271 (adj 0): stop by com.vivo.abe
02-29 09:43:32.239 701 701 E ANDR-IOP: IOP HAL: Received pkg_name = io.appium.uiautomator2.server pid = 0
罪魁祸首暴露啦 ~~~~ Force stopping io.appium.uiautomator2.server appid=10271 user=0: stop by com.vivo.abe

原来是这个家伙 com.vivo.abe 杀掉了 io.appium.uiautomator2.server 进程

解决办法

在网上查了一下 com.vivo.abe 是vivo 系统自带的应用 - 智能助手,不能删除也不能强制停止,它会自动扫描系统应用,把认为有问题的应用强制杀掉。如果有应用被它误杀,可以通过添加白名单的方法跳过检查。 配置的位置在 设置 -> 电池 -> 后台高耗电, 把 appium 相关的app都加上,然后再运行appium 自动化测试,妥妥的没有问题啦 😋

配置方法:
在这里插入图片描述

  • 4
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

四氧和三铁

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值