Json timeout in Appium C# .NET driver

We are using Appium server on a Mac to talk to an iPhone real device. Test cases are written and run on a PC using C# and the Appium .NET drivers.

On the .NET, c# side of things there appears to be a 60 second json timeout. Is there a way to change that? I understand there needs to be one, but can I change it to 120 seconds.

I find that when we start a session Appium 1.6.4 will look for the WDA, build and install if not there, start a new one if there, etc. Then it has to start our app. Not sure how are app reports successfully started, but it seems there is some time after the app starts and when Appium session returns success to PC Appium driver side. Sometimes this whole process takes longer than 60sec and I get a timeout in C# while the Appium server is still busy working. In the end the Appium server on the Mac does finish and everything worked, the Appium driver side just didn’t wait long enough. I would like just a little longer.

Nothing? No one doing this?

try with this capability:
Capabilities.SetCapability(“launchTimeout”, “180000”);

its also described in documentation as appium server flags http://appium.io/slate/en/master/?ruby#ios-only

That does not seem to help. To me that is telling Appium how long to wait for xcode and lower level items to time out before failing when launching a session. The problem here is on the C# side. When I do driver.GoDoSomething() "GoDoSomething always needs to return a response within 60 seconds or the C# driver throws an exception.

Most operations finish within 60 seconds anyway, so no big deal. In the few cases where I know I might have to wait longer for a control or display to change I code around it. The one area I see as problematic is when creating a session. In have seen Appium try to launch the WDA and after that not being successful, try to uninstall it, reinstall a new one, then launch the app. While this might eventually complete with in the “180000” timeout on that side of things, on the C# side it will throw after 60 seconds.

I can understand this needs a timeout given how the communication works, I would just like to set the C# side timeout to something other than 60 seconds.

Nothing. Dang.

I find this even worse with the UI version of Appium 1.6.4. On my machine which is a nice and powerful Mac, when start a new session the time takes 41seconds on my machine from when the C# driver send the command to when it gets a response back. This fit within the 60 second window. – For our tester in the lab who does not have the latest and greatest this starts about 50% of the time. Watching this run there is a fair amount of time that does by before we see the Webdriver start. Then our app starts and is initializing. While this is happening the C# driver timeout and throws exception. The new session while successful in that we see the our app finish launching, etc is about 10 seconds too late.

The testers have updated to 1.6.5 and now its even worse. Both the Appium UI and Appium console versions do not start up within the 60sec json timeout on the .NET appium driver side. Before it was about 50% pass rate and at least they could retry. Now its 100% of the time too slow. We are blocked.

Well as it turns out the solution was right there the whole time. Surprised some Appium developer some where cannot know and respond for this.

Anycase the constructor for the driver takes a timeout as a parameter. Its called “commandTimeout”. I could not find documentation for what this meant, and some team members assumed it was referring to Appium Server command timeouts not the HPPT request/response timeout used by low level communication layers.

Today one of the testers and I decided to give this a try. And it works. We timed launching the app at 1:11min on his setup, 11sec past the default 60sec timeout. With the timeout set to 3min creating the session passed without timing out.

driver = new IOSDriver(serverUri, capabilities, new TimeSpan(0, 3, 0));