Cory Gehr
Cory Gehr

Reputation: 127

Recurring ERR_CONNECTION_RESET in C# implementation of Selenium ChromeDriver

I've been battling the following error over the past few weeks trying to run UI tests with Selenium (Chrome 92):

WebDriverException unknown error: net::ERR_CONNECTION_RESET. (Session info: chrome=92.0.4515.107)

This occurs most often trying to locate HTML elements using XPath.

Originally, I added a retry loop which checks if the WebDriverException is thrown three times, and if so, recycle the IWebDriver and try again (via IWebDriver.Quit() and IWebDriver.Dispose(). This does not fix the problem, nor does having my application restart after exceeding the retry limit. Thus, I'm starting to think this is a problem at the system-level (Windows Server 2016). Even a reboot does not always fix the issue - when it starts to fail, it just totally freezes and I end up having to completely rebuild the environment.

I'm using the Selenium WebDriver NuGet v92.0.4515.4300; I realize this isn't in total parity with the version listed above, but having the exact same versions does not fix the problem.

I know 'unknown error' is vague. Does anyone have suggestions for what could be causing the problem?

Thanks in advance.

EDIT: Posting browser arguments here, rather than cramming them into a comment. I forgot to mention, there is an instance of Fiddler which we run as a proxy on the local system and use in conjunction with some tests. It's started and ended with the testing application.

The following are injected as options when creating the Chrome instance:

And these are added as command-line arguments through Selenium:

(We are doing some security-related detections, hence the disabling of certificate errors.)

Upvotes: 2

Views: 2318

Answers (1)

K. B.
K. B.

Reputation: 3690

  1. You mentioned that you use Fiddler, if the issue is reproducible only when it is started, you can try to regenerate the HTTPS certificates
  2. The issue can be due to the application itself. If the error is shown when you are not using Selenium/ChromeDriver you can ask your developers/devops to check the IIS settings or follow one of the suggestions below.
  3. Check your Internet options from computer Settings->Network&Internet->Proxy. On my computer "Automatically detect Settings" is enabled.
  4. You can also try to delete the Chrome browser cache.
  5. Flush the DNS (ipconfig /flushdns)
  6. It could be some rule (firewall, internal DNS record) configured for the network where is your Windows Server.
  7. Check if the issue is reproducible in incognito mode (without any browser extensions enabled). You can pass --incognito argument when starting the driver.
  8. Issue could be caused by a certificate or SSL/TLS problem.

Upvotes: 2

Related Questions