I encounter it consistently on a select set of my tests where they have to fetch the text from an element, and then tap on a descendant element if a certain condition passes. It has to do this about a hundred times and sooner or later fails like this:
OpenQA.Selenium.WebDriverException : The HTTP request to the remote WebDriver server for URL http://127.0.0.1:59604/session/8f564963-343d-4110-9732-014524fca56d/element/00000000-0001-e9ea-ffff-ffff00000066/text timed out after 60 seconds.
----> System.Threading.Tasks.TaskCanceledException : The request was canceled due to the configured HttpClient.Timeout of 60 seconds elapsing.
----> System.TimeoutException : The operation was canceled.
----> System.Threading.Tasks.TaskCanceledException : The operation was canceled.
----> System.IO.IOException : Unable to read data from the transport connection: Operation canceled.
----> System.Net.Sockets.SocketException : Operation canceled
Stack trace
at OpenQA.Selenium.Remote.HttpCommandExecutor.Execute(Command commandToExecute)
at OpenQA.Selenium.Appium.Service.AppiumCommandExecutor.Execute(Command commandToExecute)
at OpenQA.Selenium.WebDriver.Execute(String driverCommandToExecute, Dictionary2 parameters) at OpenQA.Selenium.WebElement.get_Text() at OpenQA.Selenium.Appium.AppiumElement.CacheValue(String key, Func
1 getter)
at OpenQA.Selenium.Appium.AppiumElement.get_Text()
What’s interesting is that I encounter this with appium 2.x, dotnet client 5.x and selenium 4+.
With appium 1.22, selenium 3.141 and a compatible dotnet client this would never happen at all. Possibly because I was using FindsBy attributes then, and I’m no longer using them now, I’m not sure.
Anyway, I’ve seen other people run into this error and I’m wondering how do you bypass it?
I was thinking of implementing some extension methods with retry strategy for fetching text, location, etc., on each method I encountered this on.
Is there a better way?