SeleniumHQ / selenium

A browser automation framework and ecosystem.
https://selenium.dev
Apache License 2.0
30.66k stars 8.19k forks source link

[🐛 Bug]: Selenium 4.16.x fails on selenium-manager.exe when vcuntime140.dll is not installed #13312

Closed dcdraper closed 10 months ago

dcdraper commented 10 months ago

What happened?

The C# solution is not using the Selenium Manager feature to manage chromedriver or chrome browser at all, however as of 4.16.x the entire run fails with an application error on selenium-manager.exe with message "The code execution cannot proceed because VCRUNTIME140.dll was not found. Reinstalling the program may fix this program".

The 32-bit vcruntime140.dll is not installed on our agent machines (in the syswow64 folder) in our ADO pipelines and now the tests are completely failing when attempting to start Chrome browser due to this error, even though we are not relying on selenium manager to manage anything.

Is this new dependency on vcruntime140.dll intentional or in fact an issue? We fixed it by installing the x86 redistributable for Visual Studio 2015, 2017, 2019, and 2022 from https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170#visual-studio-2015-2017-2019-and-2022

How can we reproduce the issue?

Attempt running 4.16.x "selenium-manage.exe --browser chrome --debug" on a Windows machine that does not have the vcruntime140.dll file installed in the windows/syswow64 folder.

Relevant log output

C# does not have a logging implementation, however the browser tests fail with:

OpenQA.Selenium.NoSuchDriverException : Unable to obtain chrome using Selenium Manager; For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors/driver_location
----> OpenQA.Selenium.WebDriverException : Error starting process: C:\a\2\s\SanityTestPack\bin\Debug\net7.0\selenium-manager\windows\selenium-manager.exe  --browser "chrome" --output json
----> OpenQA.Selenium.WebDriverException : Selenium Manager process exited abnormally with -1073741515 code: C:\a\2\s\SanityTestPack\bin\Debug\net7.0\selenium-manager\windows\selenium-manager.exe  --browser "chrome" --output json

Stack trace
at OpenQA.Selenium.DriverFinder.FullPath(DriverOptions options)
at OpenQA.Selenium.Chromium.ChromiumDriver.GenerateDriverServiceCommandExecutor(DriverService service, DriverOptions options, TimeSpan commandTimeout)
at OpenQA.Selenium.Chromium.ChromiumDriver..ctor(ChromiumDriverService service, ChromiumOptions options, TimeSpan commandTimeout)
at OpenQA.Selenium.Chrome.ChromeDriver..ctor(ChromeDriverService service, ChromeOptions options, TimeSpan commandTimeout)
at OpenQA.Selenium.Chrome.ChromeDriver..ctor(ChromeOptions options)
at SanityTestPack.TestBase.Base.StartWebBrowser() in C:\a\2\s\SanityTestPack\TestBase\Base.cs:line 278
at SanityTestPack.TestBase.Base.InitializeBrowser(String url, String browser) in C:\a\2\s\SanityTestPack\TestBase\Base.cs:line 114
at SanityTestPack.TestBase.Base.BeforeTestScenario() in C:\a\2\s\SanityTestPack\TestBase\Base.cs:line 41
at InvokeStub_Action`1.Invoke(Object, Object, IntPtr*)
at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.FireEvents(HookType hookType)
at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.FireScenarioEvents(HookType bindingEvent)
at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.OnScenarioStart()
at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.OnAfterLastStep()
at TechTalk.SpecFlow.TestRunner.CollectScenarioErrors()
at SanityTestPack.Specs.CompanyDispositionFeature.ScenarioCleanup()
at SanityTestPack.Specs.CompanyDispositionFeature.Company_Disposition_Create_Edit_Delete() in C:\a\2\s\SanityTestPack\Specs\CompanyDisposition.feature:line 21
at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
--WebDriverException
at OpenQA.Selenium.SeleniumManager.RunCommand(String fileName, String arguments)
at OpenQA.Selenium.SeleniumManager.DriverPath(DriverOptions options)
at OpenQA.Selenium.DriverFinder.FullPath(DriverOptions options)
--WebDriverException
at OpenQA.Selenium.SeleniumManager.RunCommand(String fileName, String arguments)

Operating System

Windows 10

Selenium version

4.16.2

What are the browser(s) and version(s) where you see this issue?

Chrome Version 120.0.6099.109 (Official Build) (64-bit)

What are the browser driver(s) and version(s) where you see this issue?

chromedriver.exe x64 version 120.0.6099.71

Are you using Selenium Grid?

no

github-actions[bot] commented 10 months ago

@dcdraper, thank you for creating this issue. We will troubleshoot it as soon as we can.


Info for maintainers

Triage this issue by using labels.

If information is missing, add a helpful comment and then I-issue-template label.

If the issue is a question, add the I-question label.

If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.

If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C), add the applicable G-* label, and it will provide the correct link and auto-close the issue.

After troubleshooting the issue, please add the R-awaiting answer label.

Thank you!

titusfortner commented 10 months ago

@dcdraper can you run the command on the downloaded version of Selenium-manager in the Debug directory and see if you get the same issue? We want to see if it is a dotnet issue or a binary issue on your computer.

@nvborisenko will the new logging solution give us information about what SM is erroring with?

RobLSDev commented 10 months ago

We now have a similar issue on 4.16.x on Windows. Backing down to 4.15 is working just fine. We do install the latest vc redist runtime for x64 on the server, any attempt to run selenium-manager results in the -1073741515 error code.

titusfortner commented 10 months ago

@RobLSDev what language? Or is this with the selenium manager executable directly?

RobLSDev commented 10 months ago

@RobLSDev what language? Or is this with the selenium manager executable directly?

We are using .net 8.0, but I logged onto the VM and tried executing it directly. Even selenium-manager --help returned the same error code.

nvborisenko commented 10 months ago

Duplicate of https://github.com/SeleniumHQ/selenium/issues/13261

titusfortner commented 10 months ago

Aha, I thought it looked familiar. I looked for a change in the rust/ directory and didn't see anything It was fixed with a CI change.

4.17 will have the fix.

dcdraper commented 10 months ago

Thank you everyone!

Sorry about the duplicate report here; I didn't look thru closed issues :-/

github-actions[bot] commented 9 months ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.