Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebDriverManager for .Net - DriverManager + VersionResolveStrategy.MatchingBrowser throws a System.IO.FileNotFoundException #315

Open
belugui opened this issue Feb 22, 2024 · 2 comments

Comments

@belugui
Copy link

belugui commented Feb 22, 2024

Hello, I will start by saying that I have used DriverManager for .Net for quite sometime and it has worked Ok for me while executing tests in my local and over SelfHosted or OnPrem VMs where I have control of the Chrome Browser version installed, but nowadays that I am planning to execute tests over Azure Hosted machines is that I require to take advantage of something like the "VersionResolveStrategy.MatchingBrowser" option to pull the right Chrome Driver version (sometimes that one may not be the latest one) to match the Chrome Browser version from the Microsoft's windows-latest image.

In theory, "VersionResolveStrategy.MatchingBrowser" will solve this for me, except that it is throwing a system exception.

Below lines I have tested separatelly with positive results:
new DriverManager().SetUpDriver(new ChromeConfig());
new DriverManager().SetUpDriver(new ChromeConfig(), "Latest");
new DriverManager().SetUpDriver(new ChromeConfig(), "122.0.6261.57");

This is the line that when executed, throws the exception:
new DriverManager().SetUpDriver(new ChromeConfig(), VersionResolveStrategy.MatchingBrowser);

Here you have the Stack Trace:

Message: 
System.IO.FileNotFoundException : C:\Users\xxxxx\AppData\Local\Chromium\Application\chrome.exe

Stack Trace: 
FileVersionInfo.GetVersionInfo(String fileName)
RegistryHelper.GetInstalledBrowserVersionWin(String executableFileName)
ChromeConfig.GetRawBrowserVersion()
ChromeConfig.GetMatchingBrowserVersion()
DriverManager.GetVersionToDownload(IDriverConfig config, String version)
DriverManager.SetUpDriver(IDriverConfig config, String version, Architecture architecture)

Chrome Browser version installed on my local is: 122.0.6261.58
WebDriverManager version in the project is: 2.17.2

@rosolko
Copy link
Owner

rosolko commented Feb 23, 2024

Is this path valid C:\Users\xxxxx\AppData\Local\Chromium\Application\chrome.exe and chrome really exists there?
For first it's really strange that you're trying to communicate with chrome but file path points to chromium

@andriusrbsy
Copy link

I encountered a similar error on my Windows machine. The issue was that my registry key "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe" was pointing to an outdated version of Chrome installed at "C:\Users\andrius.ramanauskas\AppData\Local\Chromium\Application\chrome.exe" (version 79.0.3918.0), which likely came pre-installed on my PC.

However, my actual Chrome browser is located at "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe", and the registry key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe" correctly points to this location.

Deleting the "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe" registry key resolved the issue, and DriverManager started working normally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants