【问题标题】:An unknown server-side error occurred while processing the command. Could not proxy command to remote server. Original error: Error: socket hang up处理命令时发生未知的服务器端错误。无法将命令代理到远程服务器。原始错误:错误:套接字挂起
【发布时间】:2020-03-23 07:37:30
【问题描述】:

如果我运行 TestNG 测试类,它会显示错误------------

org.openqa.selenium.WebDriverException: 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 (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 281 milliseconds
Build info: version: '2.53.1', revision: 'a36b8b1cd5757287168e54b817830adce9b0158d', time: '2016-06-30 19:26:09'
System info: host: 'MON-PC305', ip: '10.101.0.119', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_144'
Driver info: io.appium.java_client.android.AndroidDriver
Capabilities [{appPackage=com.app.android.game.app, statBarHeight=84, noReset=false, viewportRect={top=84, left=0, width=1440, height=2308}, deviceName=emulator-5554, platform=LINUX, deviceUDID=emulator-5554, desired={app="app path", appPackage=com.app.android.game.app, appActivity=com.app.android.game.app.activities.login.riskWarningLogin.RiskWarningLoginActivity, noReset=false, automationName=uiautomator2, skipUnlock=true, platformName=Android, deviceName=emulator-5554}, platformVersion=9, webStorageEnabled=false, automationName=uiautomator2, takesScreenshot=true, skipUnlock=true, javascriptEnabled=true, platformName=Android, deviceApiLevel=28, deviceManufacturer=Google, app=C:\Users\***\eclipse-workspace\appname\app.apk, deviceScreenSize=1440x2560, networkConnectionEnabled=true, warnings={}, databaseEnabled=false, appActivity=com.app.android.game.app.activities.login.riskWarningLogin.RiskWarningLoginActivity, pixelRatio=3.5, locationContextEnabled=false, deviceScreenDensity=560, deviceModel=Android SDK built for x86}]
Session ID: d275d496-08b0-4652-9aa9-67ae0476cdc8

【问题讨论】:

    标签: android exception driver appium-android


    【解决方案1】:

    这是因为您在代码中打开了 2 个驱动程序实例。

    URL url = new URL(Common.getProperty("URL"));
    driver = new AndroidDriver<WebElement>(url, capabilities);
    

    上面的东西。确保你只在你的西装中初始化过一次,否则它会出现你遇到的同样的错误。

    【讨论】:

      【解决方案2】:

      我遇到了一个确切的错误,但解决方案是我必须重新启动我的 Android 模拟器和 Appium 服务器。之后一切都开始工作了。

      【讨论】:

        【解决方案3】:

        不知道是不是一样,但是我在vivo手机上通过uiautomator2运行appium自动化时遇到了类似的问题。 appium错误日志是这样的

        [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
        [debug] [W3C (9ae907c5)]     at JWProxy.command (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/jsonwp-proxy/proxy.js:261:13)
        [HTTP] <-- POST /wd/hub/session/9ae907c5-5319-4f0b-92dc-fdaa47cfdcc5/element 500 139 ms - 530
        

        我这边这个问题的原因是io.appium.uiautomator2.server被系统进程com.vivo.abe杀死,因为我从logcat中捕获了以下日志

        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
        

        com.vivo.abe(名称为vivo Wisdom引擎)是vivo手机上的系统应用,无法卸载或强制停止。解决这个问题的方法有一个,只要把io.appium.uiautomator2.server加入白名单,com.vivo.abe就不会再对app执行kill了。

        方法是设置 -> 电池 -> 后台耗电高,然后将 io.appium.uiautomator2.server 添加到允许列表中。

        我执行该动作后,io.appium.uiautomator2.server不会再次被杀死,自动化脚本可以顺利运行。

        希望这可以为解决问题提供一些参考。

        【讨论】:

          猜你喜欢
          • 2017-10-21
          • 2019-01-03
          • 2022-10-14
          • 2020-06-04
          • 2017-01-24
          • 2021-10-07
          • 2018-07-26
          • 2021-04-01
          • 1970-01-01
          相关资源
          最近更新 更多