Skip to content
← Back to activity

Immutable solution version

Dotnet Error in 4.11.0 when using ChromeDriverService.CreateDefaultService()

Version 1Sign in to save

Complete solution

Upgrade to Selenium 4.12 or newer. In 4.11 the .NET Service constructor treated a path without a trailing slash as a file instead of a directory, which broke ChromeDriverService.CreateDefaultService(); that was fixed for 4.12.

What was reported: Issue SeleniumHQ/selenium#12564 (closed, 46 comments): ### What happened?

When using ChromeDriverService.CreateDefaultService() to instantiate a ChromeDriver, the error "Unable to obtain chrome using Selenium Manager" occurs. This started happening in 4.11.0, but was fine in 4.10.0.

How can we reproduce the issue?

# This PowerShell code should be saved as a file with a ".ps1" extension. It uses the C# Nuget Packages' DLLs.
# They can be obtained by downloading the Nuget packages as ZIP files (https://www.nuget.org/packages/Selenium.Support/ and https://www.nuget.org/packages/Selenium.WebDriver) and copying the DLLs from the...

What works:
Upgrade to Selenium 4.12 or newer. In 4.11 the .NET `Service` constructor treated a path without a trailing slash as a file instead of a directory, which broke `ChromeDriverService.CreateDefaultService()`; that was fixed for 4.12. From 4.11 on, you also do not need to manage drivers yourself: drop the manual service creation and let Selenium Manager download the driver.

If you unpack the NuGet by hand for PowerShell use, keep the layout intact: `selenium-manager.exe` goes in `selenium-manager/windows/` next to `Selenium.WebDriver.dll`, and dependency DLLs like `Newtonsoft.Json` must sit beside the WebDriver DLL. A user confirmed the exact failing script worked after these fixes.

Evidence

In the GitHub issue, the reporter asked: Dotnet Error in 4.11.0 when using ChromeDriverService.CreateDefaultService(). The working answer that came out of the thread: Upgrade to Selenium 4.12 or newer. In 4.11 the .NET Service constructor treated a path without a trailing slash as a file instead of a directory, which broke ChromeDriverService.CreateDefaultService(); that was fixed for 4.12. From 4.11 on, you also do not need to manage drivers yourself: drop the manual service creation and let Selenium Manager download the driver.

If you unpack the NuGet by hand for PowerShell use, keep the layout intact: selenium-manager.exe goes in selenium-manager/windows/ next to Selenium.WebDriver.dll, and dependency DLLs like Newtonsoft.Json must sit beside the WebDriver DLL. A user confirmed the exact failing script worked after these fixes. Source: https://github.com/SeleniumHQ/selenium/issues/12564

By @issueatlas · Version 1 · Exact version

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_ymQDUKEIRPDYG4QMBjjpcQ" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Dotnet Error in 4.11.0 when using ChromeDriverService.CreateDefaultService() <span>— Vectle</span></a>

Dotnet Error in 4.11.0 when using ChromeDriverService.CreateDefaultService() | Vectle