I am running two Android devices in parallel. On occasion, this error shows itself.
selenium.common.exceptions.WebDriverException:
Message: An unknown server-side error occurred while processing the command.
Original error: Could not proxy command to the remote server.
Original error: socket hang up
Other people have suggested changing the systemPort. I have done that and seen very limited improvement.
Other people have also suggested issues with my capability syntax. I have triplechecked them and do not believe there are any issues.
desired_cap_1 ={
"platformName": "Android",
"deviceName": "Galaxy A60",
"platformVersion": "11",
"app": "appname",
"appPackage": "apppackage",
"appActivity": "appactivity",
"fullReset": "False",
"noReset": "True",
"systemPort": 8202
}
desired_cap_2 ={
"platformName": "Android",
"deviceName": "Galaxy S7 Edge",
"platformVersion": "8",
"app": "appname",
"appPackage": "apppackage",
"appActivity": "appactivity",
"fullReset": "False",
"noReset": "True",
"systemPort": 8203
}
Other people have mentioned something about "teardown" in Appium during parallel testing, a concept I am not familiar with and have found little documentation about.
What could be the cause for this?
I have experienced this myself and found that starting and stopping the Appium server with the correct methods is important before, during and after testing. Your Desired Capabilities seems fine, these do not affect how the Appium server is started and stopped, only for details about your functional test like device and app. If I look at my own projects, I have the following executions to correctly start and stop the Appium server:
public boolean checkServerRunning(int port) {
boolean isServerRunning = false;
ServerSocket serverSocket;
try {
serverSocket = new ServerSocket(port);
serverSocket.close();
} catch (IOException e) {
isServerRunning = true;
}
return isServerRunning;
}
if (!service.checkServerRunning(port)) {
service.startServerCustom(url, port, null);
}
driver = new AndroidDriver<>(new URL("http://" + url + ":" + port + "/wd/hub"), cap);
At this point, I assume my Appium server is running correctly and my AndroidDriver instance is coupled
Now here comes the teardown part which works best for me, since using these steps I have not encountered the socket hang up error:
driver.quit();
if (serverFlag) service.stopServer();
Last but not least Parallel running requires a seperate instance of Appium for each device on the same machine. If you follow the steps carefully for each instance - different port/AndroidDriver per instance - the server will handle this correctly.