The HTTP request to the remote WebDriver server for URL timed out after 60 seconds

Viewed 3872

I'm getting the following error on an AWS Workspace Windows machine:

Message: 
    OpenQA.Selenium.WebDriverException : The HTTP request to the remote WebDriver server for URL http://localhost:58599/session timed out after 60 seconds.
      ----> System.Net.WebException : The operation has timed out.
  Stack Trace: 
    HttpCommandExecutor.MakeHttpRequest(HttpRequestInfo requestInfo)
    HttpCommandExecutor.Execute(Command commandToExecute)
    DriverServiceCommandExecutor.Execute(Command commandToExecute)
    RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
    RemoteWebDriver.StartSession(ICapabilities desiredCapabilities)
    RemoteWebDriver.ctor(ICommandExecutor commandExecutor, ICapabilities desiredCapabilities)
    ChromeDriver.ctor(ChromeDriverService service, ChromeOptions options, TimeSpan commandTimeout)
    ChromeDriver.ctor(ChromeOptions options)

when trying this simple program

var options = new ChromeOptions();
options.AddArgument("--user-data-dir=C:\\ChromeData");
var driver = new ChromeDriver(options);
driver.Navigate().GoToUrl("https://google.com/");
        

Same program works perfectly fine on another Windows machine.

When I try to access the url from the error message (http://localhost:58599) I'm getting this message:

{"value":{"error":"unknown command","message":"unknown command: unknown command: session","stacktrace":"Backtrace:\n\tOrdinal0 [0x0140C013+2474003]\n\tOrdinal0 [0x013A29C1+2042305]\n\tOrdinal0 [0x012B2F68+1060712]\n\tOrdinal0 [0x012F4B59+1330009]\n\tOrdinal0 [0x01294F3F+937791]\n\tOrdinal0 [0x01295446+939078]\n\tOrdinal0 [0x01295721+939809]\n\tGetHandleVerifier [0x015996FC+1590332]\n\tGetHandleVerifier [0x01648614+2306900]\n\tGetHandleVerifier [0x01499E93+543699]\n\tGetHandleVerifier [0x014992CE+540686]\n\tOrdinal0 [0x013A86BA+2066106]\n\tOrdinal0 [0x01294CD0+937168]\n\tOrdinal0 [0x01294688+935560]\n\tGetHandleVerifier [0x0167494C+2487948]\n\tBaseThreadInitThunk [0x748962C4+36]\n\tRtlSubscribeWnfStateChangeNotification [0x77DF0779+1081]\n\tRtlSubscribeWnfStateChangeNotification [0x77DF0744+1028]\n"}}

On both machines I'm using:

  • Google Chrome: 90.0.4430.212
  • ChromeDriver: 90.0.4430.24 (4c6d850f087da467d926e8eddb76550aed655991-refs/branch-heads/4430@{#429})
  • .NET Core 3.1
  • Selenium.WebDriver 3.141.0
  • chromedriver.exe is in system's PATH

It looks like the issue is environment related since same code works on one machine and not working on the other machine. I tried to re-install Google Chrome, I tried to use a different Chrome Profile, I looked for errors in Event Viewer, but I didn't find any way to have this working on the AWS Workspace windows machine.

Chrome opens on both machines, on first one it navigates to google.com while on the second one (AWS Workspace machine) it hangs and eventually I see the timeout error.

Any other ideas?

UPDATE:

I enabled logging per @alexey-r's suggestion and I got this:

[1621374784.098][INFO]: Launching chrome: "C:\Program Files\Google\Chrome\Application\chrome.exe" --disable-background-networking --disable-backgrounding-occluded-windows --disable-client-side-phishing-detection --disable-default-apps --disable-hang-monitor --disable-popup-blocking --disable-prompt-on-repost --disable-sync --enable-automation --enable-blink-features=ShadowDOMV0 --enable-logging --log-level=0 --no-first-run --no-service-autorun --password-store=basic --remote-debugging-port=0 --test-type=webdriver --use-mock-keychain --user-data-dir="C:\ChromeData" data:,
[1621374844.116][INFO]: Failed to connect to Chrome. Attempting to kill it.
[1621374844.187][INFO]: [2763cca68bf52e68f9a21a79647fa164] RESPONSE InitSession ERROR unknown error: DevToolsActivePort file doesn't exist
[1621374844.187][DEBUG]: Log type 'driver' lost 0 entries on destruction
[1621374844.187][DEBUG]: Log type 'browser' lost 0 entries on destruction

I was able to make it work by manually setting a port number

var options = new ChromeOptions();
options.AddArgument("--user-data-dir=C:\\ChromeData");
options.AddArgument("--remote-debugging-port=0");
var driver = new ChromeDriver(options);
driver.Navigate().GoToUrl("https://google.com/");

Not sure why this happens. From my understanding passing 0 as port number(just like it shows in the logs) should enable random port selection.

0 Answers
Related