Issue
Using Selenium WebDriver on .NET, when testing a web application on Chrome on Android at BrowserStack, I occasionally get the error OneTimeSetUp: OpenQA.Selenium.WebDriverException : The HTTP request to the remote WebDriver server for URL http://hub-cloud.browserstack.com/wd/hub/session timed out after 60 seconds
even though I pass a commandTimeout
to the driver that is longer:
new AndroidDriver(
myUrl,
myDriverOptions,
commandTimeout: TimeSpan.FromMinutes(2)
)
Other timeouts I have read about but do not set myself are:
- AsynchronousJavaScript - Default: 0:30
- ImplicitWait - Default: 0:00
- PageLoad - Default: 3:20
So there should not be any timeout of 60 seconds. Where does this come from? And what can I do to prevent it?
Unfortunately I do not get a proper stack trace, just this:
OneTimeSetUp: OpenQA.Selenium.WebDriverException : The HTTP request to the remote WebDriver server for URL http://hub-cloud.browserstack.com/wd/hub/session 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: The I/O operation has been aborted because of either a thread exit or an application request..
----> System.Net.Sockets.SocketException : The I/O operation has been aborted because of either a thread exit or an application request.
Solution
I have found the culprit. It is a bug in Appium.WebDriver 5.0.0-rc.1. The commandTimeout
I pass is ignored when the following constructor in class OpenQA.Selenium.Appium.AppiumDriver
(lines 77-80) is (indirectly) called:
public AppiumDriver(Uri remoteAddress, ICapabilities appiumOptions, TimeSpan commandTimeout)
: this(remoteAddress, appiumOptions, DefaultCommandTimeout, AppiumClientConfig.DefaultConfig())
{
}
In Appium.WebDriver 5.0.0-rc.4 (or earlier) it has been fixed:
public AppiumDriver(Uri remoteAddress, ICapabilities appiumOptions, TimeSpan commandTimeout)
: this(remoteAddress, appiumOptions, commandTimeout, AppiumClientConfig.DefaultConfig())
{
}
Answered By - Marco Eckstein
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.