Reputation: 151
If I ran TestNG test class it displays error ------------
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
Upvotes: 8
Views: 70771
Reputation: 1
Restarting everything seems to solve the issue. however, to ensure this doesn't occur again you can add "Close Application" or "Close Browser" in test teardown as it kills the app and WebDriver process which causes this problem.
Upvotes: 0
Reputation: 1
Always use appium-doctor to check for errors. If there are any errors. fix it first. I got the same error and I've tried finding solutions all over the place. But after running appium-doctor , somehow my java_home environment variables are removed. So I fixed them and Everything is working fine. So always run the appium doctor.
Upvotes: 0
Reputation: 1
Faced exactly the same error and followed the below steps and it got executed successfully.
adb uninstall io.appium.uiautomator2.server
adb uninstall io.appium.uiautomator2.server.test
also make sure that the android emulator is open, appium inspector is open and the session has started and then run the program.
Upvotes: 0
Reputation: 301
Stop the appium server and execute this:
adb uninstall io.appium.uiautomator2.server
adb uninstall io.appium.uiautomator2.server.test
Then restart the appium server and execute your scripts.
Upvotes: 30
Reputation: 1
I face same issue so i Uninstall the uiautomator2 and reinstall it... and my issue is resolved now
Upvotes: 0
Reputation: 1
I found a workaround in the meantime: (I'm using javascript with webdriver.io, but you can adjust to other client languages, it's the same basically)
Add the Full reset in Android Capabilities 'appium:fullReset': true,
In afterEach
Method delete the session await driver.deleteSession();
afterEach(async function () {
await driver.deleteSession();
},2);
beforeEach
methodbeforeEach(async function () {
driver = await getAppiumClient();
}, 2);
Then it'll fail the first or second time with socket hang up error, but it'll be running the third and subsequent tests successfully.
Upvotes: 0
Reputation: 11
I also faced the similar issue. When you run into such issue, you just need to run the following command on your terminal:
adb uninstall io.appium.uiautomator2.server.test
You'll get a terminal success response. Re-run your Appium server and it will work fine.
Upvotes: 1
Reputation: 169
I ran into exact same issue. Below are the quick solutions without uninstalling anything:
If you are using real device (Android). Remove the usb cable and switch off or restart your Android device.
If you are using emulator (Android). Shut it down and restart accordingly.
Connect your real device/emulator and run your test everything should be working accordingly
Upvotes: 1
Reputation: 169
I ran into an exact error but the resolution was I had to just restart both my Android emulator and also Appium server. After that everything started working.
Upvotes: 5
Reputation: 11
This happens because you have opened 2 driver instances in your code.
URL url = new URL(Common.getProperty("URL"));
driver = new AndroidDriver<WebElement>(url, capabilities);
The above stuff. Make sure you have initialized it once only in your suit otherwise it will through the same error you faced.
Upvotes: 1
Reputation: 1
No sure if it is the same, but I meet similar problem on the vivo phone when I run appium automation via the uiautomator2. The appium error log is like
[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
The reason on my side of this issue is io.appium.uiautomator2.server be killed by the system process com.vivo.abe, cause I catch the following log from the 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
The com.vivo.abe (name as Vivo Wisdom engine) is system app on vivo phone, which could not be uninstalled or force stop. There is one solution to resolve this issue, just add io.appium.uiautomator2.server to the white list, then the com.vivo.abe will not perform kill again to the app.
Method is Setting -> Battery -> High background power consumption , then add the io.appium.uiautomator2.server to the allow list.
After I perform the action, the io.appium.uiautomator2.server will not be killed again, and the automation script could run smoothly.
Hope this can give some reference to resolve the problem.
Upvotes: 0