question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Experiencing unknown server-side error "Could not proxy command to remote server."

See original GitHub issue

Hi guys,

Working on a project that runs an End-to-End test on our application that is a Microsoft Word Addin. Essentially the application fires up Word with a particular document, then using Appium to interact with our application trying to verify certain scenarios are working etc.

Our problem is that we continue to run into the following exception during our run:

System.InvalidOperationException: 'An unknown server-side error occurred while processing the command. Original error: Could not proxy. Proxy error: Could not proxy command to remote server. Original error: Error: connect ECONNREFUSED 127.0.0.1:4724'

Occurs when the E2E test has been running for a bit.

I have a feeling the way I need to deal with this issue is to catch it and try and re-connect?

If you need any more information please let me know

Appium Server Log

[info] [35m[WinAppDriver][39m [STDOUT] POST /wd/hub/session/6674E9C9-76C6-4E82-957C-519037DC48EC/moveto HTTP/1.1 [info] [35m[WinAppDriver][39m [STDOUT] Accept: application/json, / [info] [35m[WinAppDriver][39m [STDOUT] Connection: close [info] [35m[WinAppDriver][39m [STDOUT] Content-Length: 50 [info] [35m[WinAppDriver][39m [STDOUT] Content-Type: application/json; charset=utf-8 [info] [35m[WinAppDriver][39m [STDOUT] Host: 127.0.0.1:4724 [info] [35m[WinAppDriver][39m [STDOUT] User-Agent: appium [info] [35m[WinAppDriver][39m [STDOUT] [info] [35m[WinAppDriver][39m [STDOUT] {“element”:“42.199450”,“xoffset”:440,“yoffset”:75} [info] [35m[WinAppDriver][39m [STDOUT] HTTP/1.1 200 OK [info] [35m[WinAppDriver][39m [STDOUT] Content-Length: 63 [info] [35m[WinAppDriver][39m [STDOUT] Content-Type: application/json [info] [35m[WinAppDriver][39m [STDOUT] [info] [35m[WinAppDriver][39m [STDOUT] {“sessionId”:“6674E9C9-76C6-4E82-957C-519037DC48EC”,“status”:0} [debug] [35m[WD Proxy][39m Got response with status 200: {“sessionId”:“6674E9C9-76C6-4E82-957C-519037DC48EC”,“status”:0} [info] [35m[WD Proxy][39m Replacing sessionId 6674E9C9-76C6-4E82-957C-519037DC48EC with 576b44e7-4687-426e-916d-b1f068ff02c0 [info] [35m[HTTP][39m [37m<-- POST /wd/hub/session/576b44e7-4687-426e-916d-b1f068ff02c0/moveto [39m[32m200[39m [90m17 ms - 63[39m [info] [35m[HTTP][39m [90m[39m[info] [35m[HTTP][39m [37m–>[39m [37mPOST[39m [37m/wd/hub/session/576b44e7-4687-426e-916d-b1f068ff02c0/click[39m [info] [35m[HTTP][39m [90m{“button”:0}[39m [info] [35m[MJSONWP (576b44e7)][39m Driver proxy active, passing request on via HTTP proxy [debug] [35m[WD Proxy][39m Matched ‘/wd/hub/session/576b44e7-4687-426e-916d-b1f068ff02c0/click’ to command name ‘clickCurrent’ [debug] [35m[WD Proxy][39m Proxying [POST /wd/hub/session/576b44e7-4687-426e-916d-b1f068ff02c0/click] to [POST http://127.0.0.1:4724/wd/hub/session/6674E9C9-76C6-4E82-957C-519037DC48EC/click] with body: {“button”:0} [info] [35m[WinAppDriver][39m [STDOUT] [info] [35m[WinAppDriver][39m [STDOUT] [info] [35m[WinAppDriver][39m [STDOUT] ========================================== [info] [35m[WinAppDriver][39m [STDOUT] POST /wd/hub/session/6674E9C9-76C6-4E82-957C-519037DC48EC/click HTTP/1.1 [info] [35m[WinAppDriver][39m [STDOUT] Accept: application/json, / [info] [35m[WinAppDriver][39m [STDOUT] Connection: close [info] [35m[WinAppDriver][39m [STDOUT] Content-Length: 12 [info] [35m[WinAppDriver][39m [STDOUT] Content-Type: application/json; charset=utf-8 [info] [35m[WinAppDriver][39m [STDOUT] Host: 127.0.0.1:4724 [info] [35m[WinAppDriver][39m [STDOUT] User-Agent: appium [info] [35m[WinAppDriver][39m [STDOUT] [info] [35m[WinAppDriver][39m [STDOUT] {“button”:0} [warn] [35m[BaseDriver][39m Shutting down because we waited 60 seconds for a command [debug] [35m[WinAppDriver][39m Deleting WinAppDriver session [debug] [35m[WinAppDriver][39m Deleting WinAppDriver server session [debug] [35m[WD Proxy][39m Matched ‘/’ to command name ‘deleteSession’ [debug] [35m[WD Proxy][39m Proxying [DELETE /] to [DELETE http://127.0.0.1:4724/wd/hub/session/5E6D0B6F-831C-47AD-9822-6CD25E12C9B9] with no body [warn] [35m[Appium][39m Closing session, cause was ‘New Command Timeout of 60 seconds expired. Try customizing the timeout using the ‘newCommandTimeout’ desired capability’ [info] [35m[Appium][39m Removing session 115b55af-b9cd-4d80-8ae0-fd7f6ee17b9e from our master session list

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
hicks86commented, Aug 27, 2019

Ok so I think I have managed to get around this issue.

Essentially I am looping through a list of items on the app, and clicking them in turn. I was using a Thread.Sleep() after clicking to wait for the UI to catch up so I can validate the result. This seemed like it was throwing the communication out of sync with the Appium server. The way I am approaching it is to use Selenium Wait.Until() method.

So originally I was doing something like this:

for (int i = 0; i < issueItems.Count; i++)
{
    var item = issueItems[i];
    Session.Mouse.MouseMove(listElement.Coordinates, OffsetX, OffSetY);
    Session.Mouse.Click(null);
    Thread.Sleep(TimeSpan.FromSeconds(1)); //Wait for UI to catchup

    Assert.IsTrue(item.Text.Contains("XXX"));
}

However now doing this:

WebDriverWait wait = new WebDriverWait(Session, TimeSpan.FromSeconds(20));
wait.Until((d) =>
{
    try
    {
        var item = issueItems[i];
        Session.Mouse.MouseMove(listElement.Coordinates, OffsetX, OffSetY);
        Session.Mouse.Click(null);
        
        Assert.IsTrue(item.Text.Contains("XXX"));
        
        return true;
    }
    catch (Exception)
    {
        return false;
    }
});

For now this seems to be working a treat. However I would still love to know if the “Could not proxy command…” is related to the use of the heavy handed Thread.Sleep(). Any insights?

0reactions
hicks86commented, Aug 28, 2019

Hi @hassanuz are you able to point me in the direction of a “How to” connect directly to the WinAppdriver.exe? I will try it out.

Ignore this, just a case of RTFM in the ReadMe section of this repo. Was on Mobile before now back on laptop

Read more comments on GitHub >

github_iconTop Results From Across the Web

Could not proxy command to remote server. Original error
Make sure appium server is not executing. · Connect your android device with USB, also verify that device is connected properly by using...
Read more >
Appium 1.9.1 giving me "An unknown server-side error ...
Appium 1.9.1 giving me "An unknown server-side error occurred while processing the command. Original error: Could not proxy command to remote server.
Read more >
An unknown server-side error occurred while processing ...
WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: Could not proxy command to remote server.
Read more >
"Could not proxy command to the remote server. Original error ...
In this video we are going to discuss about How to Resolve: " Could not proxy command to the remote server. Original error...
Read more >
Socket Hangup error in between of test execution and it will ...
WebDriverException: An unknown server-side error occurred while processing the command. Original error: Could not proxy command to remote ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found