Lobsterpants
Lobsterpants

Reputation: 1258

Selenium ChromeDriver - the HTTP request to the remote WebDriver server for URL timed out after 60 seconds

I am using the ChromeDriver in an nunit test to test whether a complex page loads:

public ChromeDriver Driver { get; private set; }

 [OneTimeSetUp]
    public void Setup()
    {
        ChromeOptions co = new ChromeOptions{};
        co.AddArgument("no-sandbox");
        Driver = new ChromeDriver( co) ;
        Driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(120);
        Driver.Manage().Timeouts().PageLoad = TimeSpan.FromSeconds(120);
        Driver.Manage().Timeouts().AsynchronousJavaScript = TimeSpan.FromSeconds(120);
        Driver.Manage().Window.Maximize();
    }

As you can see I have tried to increase timeouts to 2 miutes everywhere yet when I run

Driver.Navigate().GoToUrl(url);

against the page I get

OpenQA.Selenium.WebDriverException : The HTTP request to the remote WebDriver server for URL timed out after 60 seconds.

The page does take longer than 60 seconds to load, So how do I increase the 60 seconds ?

Upvotes: 1

Views: 6807

Answers (1)

Guy
Guy

Reputation: 50819

You need to increase the DefaultCommandTimeout in RemoteWebDriver. You can do it by using the ChromeDriver(ChromeDriverService, ChromeOptions, TimeSpan) or ChromeDriver(string, ChromeOptions, TimeSpan) overloads

ChromeOptions co = new ChromeOptions{};

Driver = new ChromeDriver("path to ChromeDriver.exe", co, TimeSpan.FromSeconds(120));
// or
Driver = new ChromeDriver(ChromeDriverService.CreateDefaultService(), co, TimeSpan.FromSeconds(120));

Upvotes: 3

Related Questions