appium: ProxyRequestError: Could not proxy command to remote server when calling `findElement`

The problem

Intermittently my tests fail with ECONNRESET error.

I see the following in Appium server log in that case:

[JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8207/wd/hub/session/3eb27824-db8a-44d2-a613-9a7defcb85c0/element] with body: {"strategy":"xpath","selector":"//android.widget.TextView[@text=\"Some text\"]/following-sibling::android.widget.ImageView","context":"","multiple":false}
[MJSONWP] Encountered internal error running command: ProxyRequestError: Could not proxy command to remote server. Original error: Error: read ECONNRESET
    at JWProxy.proxy$ (C:\Users\Andrei_Botalov\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\appium-base-driver\lib\jsonwp-proxy\proxy.js:152:13)
    at tryCatch (C:\Users\Andrei_Botalov\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:67:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (C:\Users\Andrei_Botalov\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:315:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as throw] (C:\Users\Andrei_Botalov\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:100:21)
    at GeneratorFunctionPrototype.invoke (C:\Users\Andrei_Botalov\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:136:37)

Environment

  • Appium desktop 1.2.7 (server 1.7.1)
  • Desktop OS/version used to run Appium: Windows 10
  • Mobile platform/version under test: Real Android 6.0 phone connected via USB - Xiaomi Redmi Note 4
  • UiAutomator 2

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 1
  • Comments: 34

Most upvoted comments

Please follow below steps:

  1. Make sure appium server is not executing.

  2. Connect your android device with USB, also verify that device is connected properly by using command: adb devices

  3. Execute below commands: adb uninstall io.appium.uiautomator2.server adb uninstall io.appium.uiautomator2.server.test

  4. Start appium server

  5. Start executing appium test cases

Changing “automationName”: “uiautomator2” to

“automationName”: “appium”

fixed this for non-primary User accounts. 😃

Hi again, I think I’ve found the problem. The problem occurs due to apk installing by Appium. When your device is connected, run the following commands on the terminal and then run the Appium again. It worked for me. Commands: adb uninstall io.appium.uiautomator2.server adb uninstall io.appium.uiautomator2.server.test

I found this solution on the following link below, thanks to @sravanmedarapu comments: https://github.com/appium/appium/issues/7069

Good Luck!

I had the same issue. Recommendation from @neogeek13 solved the issue. I’ve changed automationName to Appium.

Facing this issue for a while and I have gone through most of the similar questions in this sort. @kbalakumar99 I too reached the point where we change to:

if(platform_version.equals("4.4.4"))
			{
				capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, "Appium");
			}else
			{
				capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, "uiautomator2");
			}

updated the environment to latest :

Appium - 1.8.1 Node 8.11.3 LTS npm 5.6.0 Java 10.0.1

I understood this cannot be fixed but, can be reduced using code optimizing. every now and then it comes up.

@mykola-mokhnach , adb is up to date(1.0.39) , device is also new with android version 6.0.1.