Appium 2.0.1 | Tests fail on cloud, bcs of idle_timeout

  • Platform you are automating: iOS mobile
  • Appium version: 2.0.1
  • Real Device on Cloud (BrowserStack)
  • The language you are using for writing tests: C#

We are trying to migrate to Appium 2.0.1 and now our tests keep timing out, especially when we try to run test suite. Single tests pass.
When tests fail, we receive an error :

System.AggregateException : One or more errors occurred. (The HTTP request to the remote WebDriver server for URL timed out after 60 seconds.) (Object reference not set to an instance of an object.)* *2023-08-23T09:48:13.4920657Z [ 00:01:07.94] ---- OpenQA.Selenium.WebDriverException : The HTTP request to the remote WebDriver server for URL timed out after 60 seconds.* *2023-08-23T09:48:13.4925872Z [ 00:01:07.94] -------- System.Threading.Tasks.TaskCanceledException : The request was canceled due to the configured HttpClient.Timeout of 60 seconds elapsing.* *2023-08-23T09:48:13.4929492Z [ 00:01:07.94] ------------ System.TimeoutException : The operation was canceled.* *2023-08-23T09:48:13.4932508Z [ 00:01:07.94] ---------------- System.Threading.Tasks.TaskCanceledException : The operation was canceled.* *2023-08-23T09:48:13.4933944Z [ 00:01:07.94] -------------------- System.IO.IOException : Unable to read data from the transport connection: The I/O operation has been aborted because of either a thread exit or an application request..* *2023-08-23T09:48:13.4935580Z [ 00:01:07.94] ------------------------ System.Net.Sockets.SocketException : The I/O operation has been aborted because of either a thread exit or an application request.* *2023-08-23T09:48:13.4937088Z [ 00:01:07.94] ---- System.NullReferenceException : Object reference not set to an instance of an object.

What we noticed in our logs there are many socket hang ups, and we can see that app is opened and then it times out.
The issue we could see from the Xcodelogs is that it times out trying to find an element, but we are not seeing which element, since the locator strategy of the first element on page which he should find in test is ‘ios-predicate string’ , and since we cannot see findElement method called anywhere.
On single test run, it always finds the first element on page, so that is why we are not sure if this is the cause.
If someone could take a look at the logs, and please help us debug what is the cause.


Here is one of our logs:
Appium logs (1).txt (72.1 KB)

Browserstack has a migration document for Appium 2, have you followed it?

If still seeing the issue, can you try to reproduce locally. Most people here don’t have a Browserstack account, so it’s impossible to reproduce such issues. If you don’t see the issue locally, that is also a data point that Browserstack support can use. I hope you have contacted them as well because you are paying for their service, they should be helping you to use it.

1 Like

Hi wreed,

Thanks for answering, I appreciate it.
I did follow guidelines from BS, as for locally, I get random results locally, it works 90% of the time, when it fails I can see in logs error it could not find the first element on page, which is weird bcs I can see the app being opened and login is started…could it be like a race condition of some sorts?
Attached are my Appium logs from local run on simulator.
AppiumLogsLocal.txt (384.8 KB)

Sure. Keep in mind that Appium will try to capture a screen immediately, so if there is some kind of transitional behavior going on you may need to add some kind of wait so that the app is in the state you expect. This is a good article on such strategies:

Thank you, I will take a look. I did try with basic Thread Sleep, and try/catch block, but I am still getting the timeout. I am thinking it could be the that driver.quit method is not working properly, but as I can see from the logs, session quits successfully :no_mouth:

I have another theory, bcs in Appium 2.0, the drivers for iOS(XCUITestDriver) and Android (UiAutomator2) are separated from Appium, do I need to instantiate separate driver for Appium and separate for XCUITestDriver, so I would run a test on iOS?

Although the drivers are separate in Appium 2 I haven’t needed any code change regarding drivers. You would need to instantiate drivers exactly how it’s done in Appium 1.