How to set commandTimeout on RemoteWebdriver?

Viewed 3289

How can I set the commandTimeout for a RemoteWebdriver in Selenium?

If I would do the same on a ChromeDriver, I would just do something like:

var service = ChromeDriverService.CreateDefaultService(driverPath);
var options = new ChromeOptions();
driver = new ChromeDriver(service, options, TimeSpan.FromSeconds(120));

..but what is the equivalent to this when I'm using a RemoveWebdriver? My first guess is by using something like:

var capabilities = DesiredCapabilities.Chrome();
capabilities.SetCapability("Capability-name-here",  TimeSpan.FromSeconds(120));
driver = new RemoteWebDriver(testserver, capabilities);

But I can't find any documentation on what capabilities that can be set, and what string/object I should pass to .SetCapability.

1 Answers

The constructor for RemoteWebDriver has an overload that takes a timeout argument. So the remote equivalent would be:

var options = new ChromeOptions();
var driver = new RemoteWebDriver(testserver, options.ToCapabilities(), TimeSpan.FromSeconds(120);

Note carefully that this timeout is for the HTTP requests between the local .NET bindings code and the Java remote Selenium server. It may or may not affect the command timeout between the Selenium server and its local instance of chromedriver.exe.

Related