SeleniumHQ / SeleniumHQ/selenium
[🐛 Bug]: Quit () takes a long time when driver instance is created with ChromeDriverService
- Dominant language
- Java
- Stars
- 34.5k
- Forks
- 8.7k
- Avg merge
- 2d 1h
- Merged PRs (30d)
- 92
Description
### What happened?
We've been experiencing something quite strange with Quit function of webdriver instanciated with ChromeDirverService since an upgrade to latest version:
let's say we create an instance like this :
```
Instance = new ChromeDriver( chromeOptions);
Instance.Quit() // is really quick
```
But, if we instanciate the driver with this constructor :
```
Instance2 = new ChromeDriver(ChromeDriverService.CreateDefaultService(Environment.CurrentDirectory), chromeOptions);
Instance2.Quit() ; // Quitting takes a lot of time (over 10 seconds)
```
### How can we reproduce the issue?
```shell
Instanciate a webdriver like this
var chromeOptions = new ChromeOptions();
if (headLess)
chromeOptions.AddArgument("headless");
Instance2 = new ChromeDriver(ChromeDriverService.CreateDefaultService(Environment.CurrentDirectory), chromeOptions);
```
### Relevant log output
```shell
I've turned on logging as following :
Log.SetLevel(LogEventLevel.Trace);
Log.Handlers.Add(new FileLogHandler("C:\\temp\\log_selenium_itself.txt"));
Log.SetLevel(typeof(ChromeDriverService), LogEventLevel.Trace);
Log.SetLevel(typeof(SeleniumManager), LogEventLevel.Trace);
Log.SetLevel(typeof(ChromeDriver), LogEventLevel.Trace);
The only relevant-like info I saw when comparing both constructors :
With ChromeDriverService it starts with the two following lines :
Instance2 = new ChromeDriver(ChromeDriverService.CreateDefaultService(Environment.CurrentDirectory), chromeOptions);
-----
2024-10-21 13:20:53.549 DEBUG HttpCommandExecutor: Executing command: []: newSession {"capabilities":{"firstMatch":[{"browserName":"chrome","goog:chromeOptions":{"args":["headless","ignore-certificate-errors","start-maximized"]}}]}}
2024-10-21 13:20:53.583 TRACE HttpCommandExecutor: >> Method: POST, RequestUri: 'http://localhost:52810/session', Version: 1.1, Content: System.Net.Http.ByteArrayContent, Headers:
Instance = new ChromeDriver( chromeOptions); starts with 4 lines instead
-----------------------------------------------
2024-10-21 13:21:59.163 TRACE SeleniumManager: Driver path: C:\Users\cav001\.cache\selenium\chromedriver\win64\130.0.6723.58\chromedriver.exe
2024-10-21 13:21:59.165 TRACE SeleniumManager: Browser path: C:\Program Files\Google\Chrome\Application\chrome.exe
2024-10-21 13:21:59.338 DEBUG HttpCommandExecutor: Executing command: []: newSession {"capabilities":{"firstMatch":[{"browserName":"chrome","goog:chromeOptions":{"args":["headless","ignore-certificate-errors","start-maximized"],"binary":"C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe"}}]}}
2024-10-21 13:21:59.360 TRACE HttpCommandExecutor: >> Method: POST, RequestUri: 'http://localhost:52851/session', Version: 1.1, Content: System.Net.Http.ByteArrayContent, Headers:
```
### Operating System
Windows 10 - aspnet core
### Selenium version
4.25.0
### What are the browser(s) and version(s) where you see this issue?
Chrome
### What are the browser driver(s) and version(s) where you see this issue?
Selenium.WebDriver.ChromeDriver 130.0.6723.5800
### Are you using Selenium Grid?
none
Contributor guide
Assessment
This issue has not been assessed yet.