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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[馃悰 Bug]: Parallel Test Execution Fails With "Unable to obtain chrome using Selenium Manager" #13686

Open
dcdraper opened this issue Mar 13, 2024 · 7 comments

Comments

@dcdraper
Copy link

What happened?

This is a duplicate of the following issue that was closed: #13342

If this is addressed like it says in the other issue, what version is that fixed in?

How can we reproduce the issue?

https://github.com/SeleniumHQ/selenium/issues/13342

Relevant log output

https://github.com/SeleniumHQ/selenium/issues/13342

Operating System

Windows 10

Selenium version

4.18.1

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

Chrome managed by selenium manager

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

Chrome managed by selenium manager

Are you using Selenium Grid?

no

Copy link

@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!

@diemol
Copy link
Member

diemol commented Mar 14, 2024

@bonigarcia, I think you have already done some research on this. I am trying to remember.

@dcdraper are the contents from your comment already having debug level enabled?

@bonigarcia
Copy link
Member

bonigarcia commented Mar 14, 2024

Indeed, there is another related open issue: #13511. Both issues happen in different operating systems (Windows - Linux), and the error codes differ. But it seems both occur due to concurrent access to the drivers in the cache:

  • Linux: error=26, Text file busy
  • Windows: The process cannot access the file because it is being used by another process. (os error 32)

The solution discussed for avoiding this kind of problem is to use some lock to allow cross-process, cross-language access to resources. Simon told me about a lock mechanism based on a local port (SocketLock). However, as I said in #13511, I am unsure about that solution. My current idea is to try a lock file to prevent this file system data race, but I haven't looked into that yet.

@dcdraper In addition to having the DEBUG traces, as @diemol said, it would also be interesting to get the complete stack trace from Selenium Manager. To get that, can you please use the Selenium Manager debug binary in your tests? This binary can be downloaded from here: selenium-manager-windows-debug.exe

Then, there are two options:

  1. Export the new Selenium Manager binary path using the environment variable SE_MANAGER_PATH (as explained in the doc).
  2. Overwrite your Selenium Manager binary (I believe in your case it is in C:\a\1\s\SanityTestPack\bin\Debug\net7.0\selenium-manager\windows\selenium-manager.exe).

@dcdraper
Copy link
Author

dcdraper commented Mar 14, 2024

@diemol Debug logging is not currently implemented
@bonigarcia I will try to look into this as time permits. We do have a lock mechanism in place but I did not architect it and I'm not sure it's what you're proposing.

Is there a way to just opt out of this selenium manager completely, so we are not forced into such a big fix/refactor for us? How can we make it not run at all? I fear we may hit a dead end and would need to abandon selenium completely, which would have a huge impact on our QA process.

I'm hoping to get a sample project together that shows how we use selenium. I'm not sure if that would help you understand our issue or if you would see that as us asking for support, which goes against the guidelines here.

@dcdraper
Copy link
Author

@bonigarcia the link to the doc for the Selenium Manager binary path is not working for me.

@bonigarcia
Copy link
Member

Is there a way to just opt out of this selenium manager completely, so we are not forced into such a big fix/refactor for us?

You can put the required driver(s) (e.g., chromedriver) in the PATH. That will prevent Selenium Manager from downloading new drivers. In addition, there was another way to turn off the use of Selenium Manager entirely in the bindings, but I am unsure how. @titusfortner How was that? It may be worth explaining that way on the Selenium Manager page.

the link to the doc for the Selenium Manager binary path is not working for me.

Yes, the link was broken. It is fixed now.

@dcdraper
Copy link
Author

dcdraper commented Mar 20, 2024

@bonigarcia As a workaround as of I think 4.15 we run the command "selenium-manager.exe --browser chrome --debug" on the test agent in the pipeline after building the solution and before the tests start running. This allows us to still take advantage of Selenium Manager to automate browser and driver management.

I was able to repro the issue using Selenium 4.18.1 in debug logging mode (@diemol) and also replace selenium-manager.exe with the debug version in the pipeline by copying it into the build directory (option 2 from @bonigarcia).

Here is the output:

2024-03-20T18:50:34.7016858Z Starting test execution, please wait...
2024-03-20T18:50:34.7532057Z A total of 1 test files matched the specified pattern.
2024-03-20T18:51:11.7111436Z Starting ChromeDriver 123.0.6312.58 (6b4b19e9dfbb93aa414dc045bd445287977d8d7a-refs/branch-heads/6312_46@{#3}) on port 51241
2024-03-20T18:51:11.7113216Z Only local connections are allowed.
2024-03-20T18:51:11.7114867Z Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
2024-03-20T18:51:11.7187612Z ChromeDriver was started successfully.
2024-03-20T18:51:12.2349067Z 18:51:12.225 DEBUG HttpCommandExecutor: Executing command: []: newSession {"capabilities":{"firstMatch":[{"browserName":"chrome","goog:chromeOptions":{"args":["--headless","--window-size=1920,1200","--start-maximized"],"binary":"C:\\Users\\AzDevOps\\.cache\\selenium\\chrome\\win64\\123.0.6312.58\\chrome.exe"}}]}}
2024-03-20T18:51:12.4074037Z INFO: TEST RUN DETAILS
2024-03-20T18:51:12.4074612Z Report Title: SanityTestPack Results
2024-03-20T18:51:12.4074853Z Report Folder Name: 03.20.2024-18.50.36
2024-03-20T18:51:12.4075103Z Target Test Environment: QA
2024-03-20T18:51:12.4075250Z Browser Type: CH_HEADLESS_MODE
2024-03-20T18:51:12.4075465Z Grid Execution: False
2024-03-20T18:51:12.4075618Z Log Level: INFO
2024-03-20T18:51:12.4075836Z Generate File With Failed Tests: True
2024-03-20T18:51:12.4075992Z Include Screenshots in Report: True
2024-03-20T18:51:12.4076442Z Screenshot Folder: 03.20.2024-18.50.36/screenshots
2024-03-20T18:51:12.4076667Z Use Static Report Folder Name: false
2024-03-20T18:51:12.4077058Z 
2024-03-20T18:51:12.4077244Z TEST SCENARIO DETAILS
2024-03-20T18:51:12.4077385Z Title: Company_Classification_Create_Edit_Delete
2024-03-20T18:51:12.4077795Z Categories (@Tags): Sanity
2024-03-20T18:51:12.4078017Z Method: Company_Classification_Create_Edit_Delete
2024-03-20T18:51:12.4078164Z 
2024-03-20T18:51:12.4078483Z TIME ZONE: Coordinated Universal Time (UTC 00:00:00)
2024-03-20T18:51:12.4078572Z 
2024-03-20T18:51:12.4078764Z INFO Bold: Starting Chrome headless browser
2024-03-20T18:51:12.4079044Z Given I am an Ekos Core Web Application user with the following credentials
2024-03-20T18:51:12.4079232Z   --- table step argument ---
2024-03-20T18:51:12.4079383Z   | attribute | value                |
2024-03-20T18:51:12.4079662Z   | Username  | [Producer1.Username] |
2024-03-20T18:51:12.4079788Z   | Password  | [Producer1.Password] |
2024-03-20T18:51:12.4080019Z -> skipped because of previous errors
2024-03-20T18:51:12.4080176Z When I log into the Ekos Core Web Application
2024-03-20T18:51:12.4080346Z -> skipped because of previous errors
2024-03-20T18:51:12.4080658Z When I create a Company Classification via the Ekos Core Web Application Management Settings Group Customize List Options Company Classification View with the following details
2024-03-20T18:51:12.4080985Z   --- table step argument ---
2024-03-20T18:51:12.4081121Z   | attribute | value                                 |
2024-03-20T18:51:12.4081351Z   | Title     | Classification {Letters2} {Timestamp} |
2024-03-20T18:51:12.4081508Z -> skipped because of previous errors
2024-03-20T18:51:12.4081781Z Then the create details of the Company Classification are correct in the Object Designer Database
2024-03-20T18:51:12.4082025Z -> skipped because of previous errors
2024-03-20T18:51:12.4082316Z When I edit the existing Company Classification via the Ekos Core Web Application Management Settings Group Customize List Options Company Classification View with the following details
2024-03-20T18:51:12.4082614Z   --- table step argument ---
2024-03-20T18:51:12.4082782Z   | attribute | value                                 |
2024-03-20T18:51:12.4082978Z   | Title     | Classification {Letters2} {Timestamp} |
2024-03-20T18:51:12.4083168Z -> skipped because of previous errors
2024-03-20T18:51:12.4083415Z Then the edit details of the Company Classification are correct in the Object Designer Database
2024-03-20T18:51:12.4083686Z -> skipped because of previous errors
2024-03-20T18:51:12.4084103Z When I delete or retire the existing Company Classification via the Ekos Core Web Application Management Settings Group Customize List Options Company Classification View
2024-03-20T18:51:12.4084321Z -> skipped because of previous errors
2024-03-20T18:51:12.4084596Z Then the delete or retire details of the Company Classification are correct in the Object Designer Database
2024-03-20T18:51:12.4084841Z -> skipped because of previous errors
2024-03-20T18:51:12.4085060Z INFO Bold: Ending test..
2024-03-20T18:51:12.4085379Z ERROR: 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
2024-03-20T18:51:12.4085908Z   ----> OpenQA.Selenium.WebDriverException : Error starting process: C:\a\2\s\SanityTestPack\bin\Debug\net8.0\selenium-manager\windows\selenium-manager.exe  --browser "chrome" --language-binding csharp --output json
2024-03-20T18:51:12.4086406Z   ----> OpenQA.Selenium.WebDriverException : Selenium Manager process exited abnormally with 65 code: C:\a\2\s\SanityTestPack\bin\Debug\net8.0\selenium-manager\windows\selenium-manager.exe  --browser "chrome" --language-binding csharp --output json
2024-03-20T18:51:12.4086733Z Standard Output >>
2024-03-20T18:51:12.4086885Z {
2024-03-20T18:51:12.4086970Z   "logs": [
2024-03-20T18:51:12.4087052Z     {
2024-03-20T18:51:12.4087169Z       "level": "ERROR",
2024-03-20T18:51:12.4087276Z       "timestamp": 1710960665,
2024-03-20T18:51:12.4087567Z       "message": "The process cannot access the file because it is being used by another process. (os error 32)"
2024-03-20T18:51:12.4087961Z     }
2024-03-20T18:51:12.4088042Z   ],
2024-03-20T18:51:12.4088258Z   "result": {
2024-03-20T18:51:12.4088375Z     "code": 65,
2024-03-20T18:51:12.4088585Z     "message": "The process cannot access the file because it is being used by another process. (os error 32)",
2024-03-20T18:51:12.4088748Z     "driver_path": "",
2024-03-20T18:51:12.4089149Z     "browser_path": ""
2024-03-20T18:51:12.4089316Z   }
2024-03-20T18:51:12.4089464Z }
2024-03-20T18:51:12.4089531Z 
2024-03-20T18:51:12.4089677Z <<
2024-03-20T18:51:12.4089737Z 
2024-03-20T18:51:12.4089772Z 
2024-03-20T18:51:12.4524610Z   Failed Company_Classification_Create_Edit_Delete [36 s]
2024-03-20T18:51:12.4525156Z   Error Message:
2024-03-20T18:51:12.4525589Z    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
2024-03-20T18:51:12.4526360Z   ----> OpenQA.Selenium.WebDriverException : Error starting process: C:\a\2\s\SanityTestPack\bin\Debug\net8.0\selenium-manager\windows\selenium-manager.exe  --browser "chrome" --language-binding csharp --output json
2024-03-20T18:51:12.4527072Z   ----> OpenQA.Selenium.WebDriverException : Selenium Manager process exited abnormally with 65 code: C:\a\2\s\SanityTestPack\bin\Debug\net8.0\selenium-manager\windows\selenium-manager.exe  --browser "chrome" --language-binding csharp --output json
2024-03-20T18:51:12.4527656Z Standard Output >>
2024-03-20T18:51:12.4527804Z {
2024-03-20T18:51:12.4527903Z   "logs": [
2024-03-20T18:51:12.4528031Z     {
2024-03-20T18:51:12.4528167Z       "level": "ERROR",
2024-03-20T18:51:12.4528316Z       "timestamp": 1710960665,
2024-03-20T18:51:12.4528509Z       "message": "The process cannot access the file because it is being used by another process. (os error 32)"
2024-03-20T18:51:12.4528697Z     }
2024-03-20T18:51:12.4528831Z   ],
2024-03-20T18:51:12.4528929Z   "result": {
2024-03-20T18:51:12.4529324Z     "code": 65,
2024-03-20T18:51:12.4529504Z     "message": "The process cannot access the file because it is being used by another process. (os error 32)",
2024-03-20T18:51:12.4529782Z     "driver_path": "",
2024-03-20T18:51:12.4529917Z     "browser_path": ""
2024-03-20T18:51:12.4530082Z   }
2024-03-20T18:51:12.4530218Z }
2024-03-20T18:51:12.4530482Z 
2024-03-20T18:51:12.4530625Z <<
2024-03-20T18:51:12.4530693Z 
2024-03-20T18:51:12.4530786Z   Stack Trace:
2024-03-20T18:51:12.4531012Z      at OpenQA.Selenium.DriverFinder.FullPath(DriverOptions options)
2024-03-20T18:51:12.4531639Z    at OpenQA.Selenium.Chromium.ChromiumDriver.GenerateDriverServiceCommandExecutor(DriverService service, DriverOptions options, TimeSpan commandTimeout)
2024-03-20T18:51:12.4532022Z    at OpenQA.Selenium.Chromium.ChromiumDriver..ctor(ChromiumDriverService service, ChromiumOptions options, TimeSpan commandTimeout)
2024-03-20T18:51:12.4532785Z    at OpenQA.Selenium.Chrome.ChromeDriver..ctor(ChromeDriverService service, ChromeOptions options, TimeSpan commandTimeout)
2024-03-20T18:51:12.4533154Z    at OpenQA.Selenium.Chrome.ChromeDriver..ctor(ChromeOptions options)
2024-03-20T18:51:12.4533499Z    at SanityTestPack.TestBase.Base.StartWebBrowser() in C:\a\2\s\SanityTestPack\TestBase\Base.cs:line 276
2024-03-20T18:51:12.4533912Z    at SanityTestPack.TestBase.Base.InitializeBrowser(String url, String browser) in C:\a\2\s\SanityTestPack\TestBase\Base.cs:line 112
2024-03-20T18:51:12.4534296Z    at SanityTestPack.TestBase.Base.BeforeTestScenario() in C:\a\2\s\SanityTestPack\TestBase\Base.cs:line 37
2024-03-20T18:51:12.4534629Z    at InvokeStub_Action`1.Invoke(Object, Span`1)
2024-03-20T18:51:12.4534961Z    at System.Reflection.MethodBaseInvoker.InvokeWithOneArg(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
2024-03-20T18:51:12.4536725Z    at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.FireEvents(HookType hookType)
2024-03-20T18:51:12.4537020Z    at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.FireScenarioEvents(HookType bindingEvent)
2024-03-20T18:51:12.4537480Z    at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.OnScenarioStart()
2024-03-20T18:51:12.4537744Z    at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.OnAfterLastStep()
2024-03-20T18:51:12.4538015Z    at TechTalk.SpecFlow.TestRunner.CollectScenarioErrors()
2024-03-20T18:51:12.4538257Z    at SanityTestPack.Specs.CompanyClassificationFeature.ScenarioCleanup()
2024-03-20T18:51:12.4538631Z    at SanityTestPack.Specs.CompanyClassificationFeature.Company_Classification_Create_Edit_Delete() in C:\a\2\s\SanityTestPack\Specs\CompanyClassification.feature:line 21
2024-03-20T18:51:12.4538993Z    at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
2024-03-20T18:51:12.4539315Z    at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
2024-03-20T18:51:12.4539547Z --WebDriverException
2024-03-20T18:51:12.4539753Z    at OpenQA.Selenium.SeleniumManager.RunCommand(String fileName, String arguments)
2024-03-20T18:51:12.4540007Z    at OpenQA.Selenium.SeleniumManager.DriverPath(DriverOptions options)
2024-03-20T18:51:12.4540277Z    at OpenQA.Selenium.DriverFinder.FullPath(DriverOptions options)
2024-03-20T18:51:12.4540485Z --WebDriverException
2024-03-20T18:51:12.4540662Z    at OpenQA.Selenium.SeleniumManager.RunCommand(String fileName, String arguments)
2024-03-20T18:51:12.4540786Z 
2024-03-20T18:51:12.4540953Z   Standard Output Messages:
2024-03-20T18:51:12.4541111Z  INFO: TEST RUN DETAILS
2024-03-20T18:51:12.4541438Z  Report Title: SanityTestPack Results
2024-03-20T18:51:12.4541591Z  Report Folder Name: 03.20.2024-18.50.36
2024-03-20T18:51:12.4541812Z  Target Test Environment: QA
2024-03-20T18:51:12.4541949Z  Browser Type: CH_HEADLESS_MODE
2024-03-20T18:51:12.4542254Z  Grid Execution: False
2024-03-20T18:51:12.4542374Z  Log Level: INFO
2024-03-20T18:51:12.4542613Z  Generate File With Failed Tests: True
2024-03-20T18:51:12.4542813Z  Include Screenshots in Report: True
2024-03-20T18:51:12.4542999Z  Screenshot Folder: 03.20.2024-18.50.36/screenshots
2024-03-20T18:51:12.4543139Z  Use Static Report Folder Name: false
2024-03-20T18:51:12.4543333Z  
2024-03-20T18:51:12.4543446Z  TEST SCENARIO DETAILS
2024-03-20T18:51:12.4543639Z  Title: Company_Classification_Create_Edit_Delete
2024-03-20T18:51:12.4543819Z  Categories (@Tags): Sanity
2024-03-20T18:51:12.4544019Z  Method: Company_Classification_Create_Edit_Delete
2024-03-20T18:51:12.4544225Z  
2024-03-20T18:51:12.4544373Z  TIME ZONE: Coordinated Universal Time (UTC 00:00:00)
2024-03-20T18:51:12.4544586Z  
2024-03-20T18:51:12.4544714Z  INFO Bold: Starting Chrome headless browser
2024-03-20T18:51:12.4544966Z  Given I am an Ekos Core Web Application user with the following credentials
2024-03-20T18:51:12.4545187Z    --- table step argument ---
2024-03-20T18:51:12.4545346Z    | attribute | value                |
2024-03-20T18:51:12.4545592Z    | Username  | [Producer1.Username] |
2024-03-20T18:51:12.4545736Z    | Password  | [Producer1.Password] |
2024-03-20T18:51:12.4545954Z  -> skipped because of previous errors
2024-03-20T18:51:12.4546150Z  When I log into the Ekos Core Web Application
2024-03-20T18:51:12.4546312Z  -> skipped because of previous errors
2024-03-20T18:51:12.4546648Z  When I create a Company Classification via the Ekos Core Web Application Management Settings Group Customize List Options Company Classification View with the following details
2024-03-20T18:51:12.4547088Z    --- table step argument ---
2024-03-20T18:51:12.4547219Z    | attribute | value                                 |
2024-03-20T18:51:12.4547559Z    | Title     | Classification {Letters2} {Timestamp} |
2024-03-20T18:51:12.4547711Z  -> skipped because of previous errors
2024-03-20T18:51:12.4548342Z  Then the create details of the Company Classification are correct in the Object Designer Database
2024-03-20T18:51:12.4548580Z  -> skipped because of previous errors
2024-03-20T18:51:12.4549034Z  When I edit the existing Company Classification via the Ekos Core Web Application Management Settings Group Customize List Options Company Classification View with the following details
2024-03-20T18:51:12.4549320Z    --- table step argument ---
2024-03-20T18:51:12.4549664Z    | attribute | value                                 |
2024-03-20T18:51:12.4549790Z    | Title     | Classification {Letters2} {Timestamp} |
2024-03-20T18:51:12.4550019Z  -> skipped because of previous errors
2024-03-20T18:51:12.4550257Z  Then the edit details of the Company Classification are correct in the Object Designer Database
2024-03-20T18:51:12.4550491Z  -> skipped because of previous errors
2024-03-20T18:51:12.4550812Z  When I delete or retire the existing Company Classification via the Ekos Core Web Application Management Settings Group Customize List Options Company Classification View
2024-03-20T18:51:12.4551293Z  -> skipped because of previous errors
2024-03-20T18:51:12.4551538Z  Then the delete or retire details of the Company Classification are correct in the Object Designer Database
2024-03-20T18:51:12.4551771Z  -> skipped because of previous errors
2024-03-20T18:51:12.4551981Z  INFO Bold: Ending test..
2024-03-20T18:51:12.4552276Z  ERROR: 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
2024-03-20T18:51:12.4552756Z    ----> OpenQA.Selenium.WebDriverException : Error starting process: C:\a\2\s\SanityTestPack\bin\Debug\net8.0\selenium-manager\windows\selenium-manager.exe  --browser "chrome" --language-binding csharp --output json
2024-03-20T18:51:12.4553242Z    ----> OpenQA.Selenium.WebDriverException : Selenium Manager process exited abnormally with 65 code: C:\a\2\s\SanityTestPack\bin\Debug\net8.0\selenium-manager\windows\selenium-manager.exe  --browser "chrome" --language-binding csharp --output json
2024-03-20T18:51:12.4553568Z  Standard Output >>
2024-03-20T18:51:12.4553700Z  {
2024-03-20T18:51:12.4553782Z    "logs": [
2024-03-20T18:51:12.4553931Z      {
2024-03-20T18:51:12.4554047Z        "level": "ERROR",
2024-03-20T18:51:12.4554217Z        "timestamp": 1710960665,
2024-03-20T18:51:12.4554435Z        "message": "The process cannot access the file because it is being used by another process. (os error 32)"
2024-03-20T18:51:12.4554578Z      }
2024-03-20T18:51:12.4554679Z    ],
2024-03-20T18:51:12.4554761Z    "result": {
2024-03-20T18:51:12.4554849Z      "code": 65,
2024-03-20T18:51:12.4555027Z      "message": "The process cannot access the file because it is being used by another process. (os error 32)",
2024-03-20T18:51:12.4555178Z      "driver_path": "",
2024-03-20T18:51:12.4555301Z      "browser_path": ""
2024-03-20T18:51:12.4555390Z    }
2024-03-20T18:51:12.4555464Z  }
2024-03-20T18:51:12.4555564Z  
2024-03-20T18:51:12.4555637Z  <<

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