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

[🐛 Bug]: Selenium unable to connect to Chrome 128 when not directly installed #14438

Open
fredericDelaporte opened this issue Aug 26, 2024 · 12 comments

Comments

@fredericDelaporte
Copy link

fredericDelaporte commented Aug 26, 2024

What happened?

We have .Net console application run as a Windows Service which uses Selenium to drive Chrome, through Selenium.WebDriver.ChromeDriver 128 and Selenium.WebDriver 4.23. So, it is run under Windows 11 and Windows Server 2022.

In our different environments, it has started to fail since last week, with the latest affected environment failing since yesterday (Sunday 25 of August). It appears to fail working with Chrome 128. The BrowserVersion option was set as stable. Forcing it to 127 restores the application, allowing it to operate normally. Switching back to stable or forcing it explicitly to 128 causes the trouble to appear again.

The trouble was originally seen while using ChromeDriver 127. Upgrading it to 128 changed nothing. Purging the .cache/selenium folder did not help.

The trouble is not reproducible on a machine on which Chrome 128 is directly installed. If it is not installed, or if only an older version is installed, the trouble occurs.

When there is the trouble, the application logs contain an error about a network service crash, then a "Sandbox cannot access executable" error, then timeouts from renderer.

Chrome-Error-Log.txt
Chrome-Normal-Log.txt

Moreover, running the application locally in an interactive session show a blank window appearing, when the trouble occurs.
Chrome-Blank-Windows

Of course it may be a Chrome or Chromedriver issue instead of a Selenium one, but I do not know. Still it makes Chrome 128 unusable with Selenium and Windows if there is no standalone installation of Chrome.

And maybe the CI troubles in #14429 are related since it seems to upgrade some things to the 128 version.

How can we reproduce the issue?

Make sure Chrome is not installed at all on the test machine.

In a new net8 Console app project, add Nuget references to Selenium.WebDriver 4.27, and paste this code into the Program.cs file:

using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.Internal.Logging;

Log.SetLevel(LogEventLevel.Trace);
var driverOptions = new ChromeOptions()
{
    BrowserVersion = "128"
};
driverOptions.AddArgument("headless");
using var driver = new ChromeDriver(driverOptions);

Console.WriteLine("Press enter to leave");
Console.ReadLine();
Console.WriteLine("Closing Chrome");
driver.Close();
Console.WriteLine("Exiting");

I have not added rendering calls, so that minimal example only shows the initialization troubles including the blank window, not the rendering timeouts. Using 127 as the BrowserVersion makes the initialization troubles disappear.

Relevant log output

14:08:59.501 TRACE SeleniumManager: Driver path: C:\Users\fdelaporte\.cache\selenium\chromedriver\win64\128.0.6613.84\chromedriver.exe
14:08:59.526 TRACE SeleniumManager: Browser path: C:\Users\fdelaporte\.cache\selenium\chrome\win64\128.0.6613.84\chrome.exe
Starting ChromeDriver 128.0.6613.84 (606aa55c7d687518d34b55accc5a71ea0bd28727-refs/branch-heads/6613@{#1335}) on port 51150
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully on port 51150.
14:08:59.866 DEBUG HttpCommandExecutor: Executing command: []: newSession {"capabilities":{"firstMatch":[{"browserName":"chrome","goog:chromeOptions":{"args":["headless"],"binary":"C:\\Users\\fdelaporte\\.cache\\selenium\\chrome\\win64\\128.0.6613.84\\chrome.exe"}}]}}
14:08:59.873 TRACE HttpCommandExecutor: >> Method: POST, RequestUri: 'http://localhost:51150/session', Version: 1.1, Content: System.Net.Http.ByteArrayContent, Headers:
{
  Accept: application/json; charset=utf-8
  User-Agent: selenium/4.23.0
  User-Agent: (.net windows)
  Content-Type: application/json; charset=utf-8
  Content-Length: 194
}
{"capabilities":{"firstMatch":[{"browserName":"chrome","goog:chromeOptions":{"args":["headless"],"binary":"C:\\Users\\fdelaporte\\.cache\\selenium\\chrome\\win64\\128.0.6613.84\\chrome.exe"}}]}}
[24828:27152:0826/140900.126:ERROR:sandbox_win.cc(852)] Sandbox cannot access executable. Check filesystem permissions are valid. See https://bit.ly/31yqMJR.: Acc├¿s refus├®. (0x5)

DevTools listening on ws://127.0.0.1:51153/devtools/browser/c06b5642-48e8-49ae-b2b8-1c0c5e027cbf
[24828:3464:0826/140900.312:ERROR:network_service_instance_impl.cc(608)] Network service crashed, restarting service.
14:09:00.661 TRACE HttpCommandExecutor: << StatusCode: 200, ReasonPhrase: 'OK', Version: 1.1, Content: System.Net.Http.HttpConnectionResponseContent, Headers:
{
  Cache-Control: no-cache
  Content-Length: 866
  Content-Type: application/json; charset=utf-8
}
14:09:00.673 DEBUG HttpCommandExecutor: Response: (c29a448d094106dcb43e27a4ee178b2d Success: System.Collections.Generic.Dictionary`2[System.String,System.Object])
Press enter to leave
Created TensorFlow Lite XNNPACK delegate for CPU.

Closing driver
14:09:17.747 DEBUG HttpCommandExecutor: Executing command: [c29a448d094106dcb43e27a4ee178b2d]: close {}
14:09:17.749 TRACE HttpCommandExecutor: >> Method: DELETE, RequestUri: 'http://localhost:51150/session/c29a448d094106dcb43e27a4ee178b2d/window', Version: 1.1, Content: <null>, Headers:
{
  User-Agent: selenium/4.23.0
  User-Agent: (.net windows)
  Accept: application/json
  Accept: image/png
}
14:09:18.043 TRACE HttpCommandExecutor: << StatusCode: 200, ReasonPhrase: 'OK', Version: 1.1, Content: System.Net.Http.HttpConnectionResponseContent, Headers:
{
  Cache-Control: no-cache
  Content-Length: 12
  Content-Type: application/json; charset=utf-8
}
14:09:18.048 DEBUG HttpCommandExecutor: Response: ( Success: System.Object[])
Exiting

Operating System

Windows 11, Windows Server 2022, run from Paris, France.

Selenium version

.net 8.0.8

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

Chrome 128 (128.0.6613.84)

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

ChromeDriver 128.0.6613.84 (and 127.0.6533.119)

Are you using Selenium Grid?

No

Copy link

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

@SeleniumHQ SeleniumHQ deleted a comment Aug 26, 2024
@SeleniumHQ SeleniumHQ deleted a comment Aug 26, 2024
@SeleniumHQ SeleniumHQ deleted a comment Aug 26, 2024
@SeleniumHQ SeleniumHQ deleted a comment Aug 26, 2024
@SeleniumHQ SeleniumHQ deleted a comment Aug 26, 2024
@SeleniumHQ SeleniumHQ deleted a comment Aug 26, 2024
@SeleniumHQ SeleniumHQ deleted a comment Aug 26, 2024
@SeleniumHQ SeleniumHQ deleted a comment Aug 26, 2024
@nvborisenko
Copy link
Member

Symptoms are similar to SeleniumHQ/docker-selenium#2332 (adding --disable-search-engine-choice-screen chrome argument should resolve it).

@fredericDelaporte
Copy link
Author

fredericDelaporte commented Aug 27, 2024

This did not work. New test program:

using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.Internal.Logging;

Log.SetLevel(LogEventLevel.Trace);
var driverOptions = new ChromeOptions()
{
    BrowserVersion = "stable"
};
driverOptions.AddArgument("headless=new");
driverOptions.AddArgument("--disable-search-engine-choice-screen");
var driver = new ChromeDriver(driverOptions);

Console.WriteLine("Press enter to leave");
Console.ReadLine();
Console.WriteLine("Disposing");
driver.Dispose();
Console.WriteLine("Exiting");

New log:

09:08:05.217 TRACE SeleniumManager: Driver path: C:\Users\fdelaporte\.cache\selenium\chromedriver\win64\128.0.6613.84\chromedriver.exe
09:08:05.258 TRACE SeleniumManager: Browser path: C:\Users\fdelaporte\.cache\selenium\chrome\win64\128.0.6613.84\chrome.exe
Starting ChromeDriver 128.0.6613.84 (606aa55c7d687518d34b55accc5a71ea0bd28727-refs/branch-heads/6613@{#1335}) on port 49979
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully on port 49979.
09:08:05.913 DEBUG HttpCommandExecutor: Executing command: []: newSession {"capabilities":{"firstMatch":[{"browserName":"chrome","goog:chromeOptions":{"args":["headless=new","--disable-search-engine-choice-screen"],"binary":"C:\\Users\\fdelaporte\\.cache\\selenium\\chrome\\win64\\128.0.6613.84\\chrome.exe"}}]}}
09:08:05.926 TRACE HttpCommandExecutor: >> Method: POST, RequestUri: 'http://localhost:49979/session', Version: 1.1, Content: System.Net.Http.ByteArrayContent, Headers:
{
  Accept: application/json; charset=utf-8
  User-Agent: selenium/4.23.0
  User-Agent: (.net windows)
  Content-Type: application/json; charset=utf-8
  Content-Length: 238
}
{"capabilities":{"firstMatch":[{"browserName":"chrome","goog:chromeOptions":{"args":["headless=new","--disable-search-engine-choice-screen"],"binary":"C:\\Users\\fdelaporte\\.cache\\selenium\\chrome\\win64\\128.0.6613.84\\chrome.exe"}}]}}
[3808:18404:0827/090806.187:ERROR:sandbox_win.cc(852)] Sandbox cannot access executable. Check filesystem permissions are valid. See https://bit.ly/31yqMJR.: Acc├¿s refus├®. (0x5)

DevTools listening on ws://127.0.0.1:49984/devtools/browser/07a6bc45-3286-4ae5-9062-950a834efc94
[3808:15248:0827/090806.434:ERROR:network_service_instance_impl.cc(608)] Network service crashed, restarting service.
09:08:06.757 TRACE HttpCommandExecutor: << StatusCode: 200, ReasonPhrase: 'OK', Version: 1.1, Content: System.Net.Http.HttpConnectionResponseContent, Headers:
{
  Cache-Control: no-cache
  Content-Length: 867
  Content-Type: application/json; charset=utf-8
}
09:08:06.769 DEBUG HttpCommandExecutor: Response: (a2669725746fee118e4bf1d5897f8b01 Success: System.Collections.Generic.Dictionary`2[System.String,System.Object])
Press enter to leave
Created TensorFlow Lite XNNPACK delegate for CPU.

Disposing
09:10:06.278 DEBUG HttpCommandExecutor: Executing command: [a2669725746fee118e4bf1d5897f8b01]: quit {}
09:10:06.304 TRACE HttpCommandExecutor: >> Method: DELETE, RequestUri: 'http://localhost:49979/session/a2669725746fee118e4bf1d5897f8b01', Version: 1.1, Content: <null>, Headers:
{
  User-Agent: selenium/4.23.0
  User-Agent: (.net windows)
  Accept: application/json
  Accept: image/png
}
09:10:06.576 TRACE HttpCommandExecutor: << StatusCode: 200, ReasonPhrase: 'OK', Version: 1.1, Content: System.Net.Http.HttpConnectionResponseContent, Headers:
{
  Cache-Control: no-cache
  Content-Length: 14
  Content-Type: application/json; charset=utf-8
}
09:10:06.577 DEBUG HttpCommandExecutor: Response: ( Success: )
Exiting

D:\Temp\Tests\Chrome-Trouble\bin\Debug\net8.0\Chrome-Trouble.exe (process 21804) exited with code 0 (0x0).

I have tried setting the option before headless=new, using headless without the new value, combining both option in the same argument: same result.

But something work: headless=old, without the --disable-search-engine-choice-screen flag, makes the trouble go away, without forcing the 127 version.

That does not look as viable long term solution though.

@fredericDelaporte
Copy link
Author

I have also tried without the initial double dash just in case since headless works without, but that is still not working.

using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.Internal.Logging;

Log.SetLevel(LogEventLevel.Trace);
var driverOptions = new ChromeOptions()
{
    BrowserVersion = "stable"
};
driverOptions.AddArgument("headless");
driverOptions.AddArgument("disable-search-engine-choice-screen");
var driver = new ChromeDriver(driverOptions);

Console.WriteLine("Press enter to leave");
Console.ReadLine();
Console.WriteLine("Disposing");
driver.Dispose();
Console.WriteLine("Exiting");

Same log, same trouble.

@fredericDelaporte
Copy link
Author

If that is the search engine choice which is causing it, the trouble could be dependent on the location, from what I read elsewhere. So, these tests are run from France, Paris.

@fredericDelaporte
Copy link
Author

fredericDelaporte commented Aug 27, 2024

Another test: running the same program without the headless argument, and without the disable search engine choice option, does not show the search engine choice, but still fail.

Program:

using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.Internal.Logging;

Log.SetLevel(LogEventLevel.Trace);
var driverOptions = new ChromeOptions()
{
    BrowserVersion = "stable"
};
var driver = new ChromeDriver(driverOptions);

Console.WriteLine("Press enter to leave");
Console.ReadLine();
Console.WriteLine("Closing Chrome");
driver.Close();
Console.WriteLine("Disposing");
driver.Dispose();
Console.WriteLine("Exiting");

Same trouble, log:

12:33:35.019 TRACE SeleniumManager: Driver path: C:\Users\fdelaporte\.cache\selenium\chromedriver\win64\128.0.6613.84\chromedriver.exe
12:33:35.076 TRACE SeleniumManager: Browser path: C:\Users\fdelaporte\.cache\selenium\chrome\win64\128.0.6613.84\chrome.exe
Starting ChromeDriver 128.0.6613.84 (606aa55c7d687518d34b55accc5a71ea0bd28727-refs/branch-heads/6613@{#1335}) on port 53474
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully on port 53474.
12:33:36.057 DEBUG HttpCommandExecutor: Executing command: []: newSession {"capabilities":{"firstMatch":[{"browserName":"chrome","goog:chromeOptions":{"binary":"C:\\Users\\fdelaporte\\.cache\\selenium\\chrome\\win64\\128.0.6613.84\\chrome.exe"}}]}}
12:33:36.079 TRACE HttpCommandExecutor: >> Method: POST, RequestUri: 'http://localhost:53474/session', Version: 1.1, Content: System.Net.Http.ByteArrayContent, Headers:
{
  Accept: application/json; charset=utf-8
  User-Agent: selenium/4.23.0
  User-Agent: (.net windows)
  Content-Type: application/json; charset=utf-8
  Content-Length: 174
}
{"capabilities":{"firstMatch":[{"browserName":"chrome","goog:chromeOptions":{"binary":"C:\\Users\\fdelaporte\\.cache\\selenium\\chrome\\win64\\128.0.6613.84\\chrome.exe"}}]}}
[11644:26956:0827/123336.644:ERROR:sandbox_win.cc(852)] Sandbox cannot access executable. Check filesystem permissions are valid. See https://bit.ly/31yqMJR.: Acc├¿s refus├®. (0x5)

DevTools listening on ws://127.0.0.1:53477/devtools/browser/dbee8aef-6858-4a4b-a838-495849dee70b
[11644:19656:0827/123336.952:ERROR:network_service_instance_impl.cc(608)] Network service crashed, restarting service.
12:33:37.321 TRACE HttpCommandExecutor: << StatusCode: 200, ReasonPhrase: 'OK', Version: 1.1, Content: System.Net.Http.HttpConnectionResponseContent, Headers:
{
  Cache-Control: no-cache
  Content-Length: 866
  Content-Type: application/json; charset=utf-8
}
12:33:37.334 DEBUG HttpCommandExecutor: Response: (a314d7b0db11b02e2edb5755eaa64154 Success: System.Collections.Generic.Dictionary`2[System.String,System.Object])
Press enter to leave
Created TensorFlow Lite XNNPACK delegate for CPU.

Closing Chrome
12:36:01.288 DEBUG HttpCommandExecutor: Executing command: [a314d7b0db11b02e2edb5755eaa64154]: close {}
12:36:01.293 TRACE HttpCommandExecutor: >> Method: DELETE, RequestUri: 'http://localhost:53474/session/a314d7b0db11b02e2edb5755eaa64154/window', Version: 1.1, Content: <null>, Headers:
{
  User-Agent: selenium/4.23.0
  User-Agent: (.net windows)
  Accept: application/json
  Accept: image/png
}
12:36:01.540 TRACE HttpCommandExecutor: << StatusCode: 200, ReasonPhrase: 'OK', Version: 1.1, Content: System.Net.Http.HttpConnectionResponseContent, Headers:
{
  Cache-Control: no-cache
  Content-Length: 12
  Content-Type: application/json; charset=utf-8
}
12:36:01.543 DEBUG HttpCommandExecutor: Response: ( Success: System.Object[])
Disposing
12:36:01.546 DEBUG HttpCommandExecutor: Executing command: [a314d7b0db11b02e2edb5755eaa64154]: quit {}
12:36:01.548 TRACE HttpCommandExecutor: >> Method: DELETE, RequestUri: 'http://localhost:53474/session/a314d7b0db11b02e2edb5755eaa64154', Version: 1.1, Content: <null>, Headers:
{
  User-Agent: selenium/4.23.0
  User-Agent: (.net windows)
  Accept: application/json
  Accept: image/png
}
12:36:01.643 TRACE HttpCommandExecutor: << StatusCode: 200, ReasonPhrase: 'OK', Version: 1.1, Content: System.Net.Http.HttpConnectionResponseContent, Headers:
{
  Cache-Control: no-cache
  Content-Length: 14
  Content-Type: application/json; charset=utf-8
}
12:36:01.644 DEBUG HttpCommandExecutor: Response: ( Success: )
Exiting

D:\Temp\Tests\Chrome-Trouble\bin\Debug\net8.0\Chrome-Trouble.exe (process 27468) exited with code 0 (0x0).

And screenshot of opened Chrome:
image

Quick translations if that helps:

Chrome for Testing v128.0.6613.84 est réservé aux tests automatisés. Pour une navigation normale, utilisez une version standard de Chrome qui se met à jour automatiquement. Téléchargez Chrome

Means:

Chrome for Testing v128.0.6613.84 is meant for automated testing. For regular browsing, use a standard Chrome version with automated updates. Download Chrome

And:

Chrome est contrôlé par un logiciel de test automatisé.

Means:

Chrome is controlled by automated testing software.

@fredericDelaporte
Copy link
Author

fredericDelaporte commented Aug 27, 2024

When Chrome is directly installed on the machine, here is the log of the same program, no more failing to connect to Chrome:

12:57:52.402 TRACE SeleniumManager: Driver path: C:\Users\fdelaporte\.cache\selenium\chromedriver\win64\128.0.6613.84\chromedriver.exe
12:57:52.519 TRACE SeleniumManager: Browser path: C:\Program Files\Google\Chrome\Application\chrome.exe
Starting ChromeDriver 128.0.6613.84 (606aa55c7d687518d34b55accc5a71ea0bd28727-refs/branch-heads/6613@{#1335}) on port 52040
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully on port 52040.
12:57:53.693 DEBUG HttpCommandExecutor: Executing command: []: newSession {"capabilities":{"firstMatch":[{"browserName":"chrome","goog:chromeOptions":{"binary":"C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe"}}]}}
12:57:53.719 TRACE HttpCommandExecutor: >> Method: POST, RequestUri: 'http://localhost:52040/session', Version: 1.1, Content: System.Net.Http.ByteArrayContent, Headers:
{
  Accept: application/json; charset=utf-8
  User-Agent: selenium/4.23.0
  User-Agent: (.net windows)
  Content-Type: application/json; charset=utf-8
  Content-Length: 151
}
{"capabilities":{"firstMatch":[{"browserName":"chrome","goog:chromeOptions":{"binary":"C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe"}}]}}

DevTools listening on ws://127.0.0.1:52052/devtools/browser/bf746c0d-1fd8-461b-a27c-34b7d499faac
12:57:55.226 TRACE HttpCommandExecutor: << StatusCode: 200, ReasonPhrase: 'OK', Version: 1.1, Content: System.Net.Http.HttpConnectionResponseContent, Headers:
{
  Cache-Control: no-cache
  Content-Length: 885
  Content-Type: application/json; charset=utf-8
}
12:57:55.259 DEBUG HttpCommandExecutor: Response: (59379d364e0d8aa00fdcbbd32648e6ba Success: System.Collections.Generic.Dictionary`2[System.String,System.Object])
Press enter to leave
Created TensorFlow Lite XNNPACK delegate for CPU.

Closing Chrome
13:00:12.403 DEBUG HttpCommandExecutor: Executing command: [59379d364e0d8aa00fdcbbd32648e6ba]: close {}
13:00:12.406 TRACE HttpCommandExecutor: >> Method: DELETE, RequestUri: 'http://localhost:52040/session/59379d364e0d8aa00fdcbbd32648e6ba/window', Version: 1.1, Content: <null>, Headers:
{
  User-Agent: selenium/4.23.0
  User-Agent: (.net windows)
  Accept: application/json
  Accept: image/png
}
13:00:12.485 TRACE HttpCommandExecutor: << StatusCode: 500, ReasonPhrase: 'Internal Server Error', Version: 1.1, Content: System.Net.Http.HttpConnectionResponseContent, Headers:
{
  Cache-Control: no-cache
  Content-Length: 1105
  Content-Type: application/json; charset=utf-8
}
{"value":{"error":"disconnected","message":"disconnected: not connected to DevTools\n  (failed to check if window was closed: disconnected: not connected to DevTools)\n  (Session info: chrome=128.0.6613.85)","stacktrace":"\tGetHandleVerifier [0x00007FF7A057B632+29090]\n\t(No symbol) [0x00007FF7A04EE6E9]\n\t(No symbol) [0x00007FF7A03AB1CA]\n\t(No symbol) [0x00007FF7A0391296]\n\t(No symbol) [0x00007FF7A039231F]\n\t(No symbol) [0x00007FF7A03AB7E3]\n\t(No symbol) [0x00007FF7A037F5ED]\n\t(No symbol) [0x00007FF7A0436497]\n\t(No symbol) [0x00007FF7A0435A29]\n\t(No symbol) [0x00007FF7A04266B0]\n\t(No symbol) [0x00007FF7A03F09B1]\n\t(No symbol) [0x00007FF7A03F1B11]\n\tGetHandleVerifier [0x00007FF7A089881D+3294093]\n\tGetHandleVerifier [0x00007FF7A08E4403+3604339]\n\tGetHandleVerifier [0x00007FF7A08DA2C7+3563063]\n\tGetHandleVerifier [0x00007FF7A0636F16+797318]\n\t(No symbol) [0x00007FF7A04F986F]\n\t(No symbol) [0x00007FF7A04F5454]\n\t(No symbol) [0x00007FF7A04F55E0]\n\t(No symbol) [0x00007FF7A04E4A7F]\n\tBaseThreadInitThunk [0x00007FFBB091257D+29]\n\tRtlUserThreadStart [0x00007FFBB22AAF28+40]\n"}}
13:00:12.493 DEBUG HttpCommandExecutor: Response: ( UnhandledError: System.Collections.Generic.Dictionary`2[System.String,System.Object])
Unhandled exception. OpenQA.Selenium.WebDriverException: disconnected: not connected to DevTools
  (failed to check if window was closed: disconnected: not connected to DevTools)
  (Session info: chrome=128.0.6613.85)
   at OpenQA.Selenium.WebDriver.UnpackAndThrowOnError(Response errorResponse, String commandToExecute)
   at OpenQA.Selenium.WebDriver.ExecuteAsync(String driverCommandToExecute, Dictionary`2 parameters)
   at OpenQA.Selenium.WebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
   at OpenQA.Selenium.WebDriver.Close()
   at Program.<Main>$(String[] args) in D:\Temp\Tests\Chrome-Trouble\Program.cs:line 16

But failing at the Close, which seems superfluous: Dispose seems enough to close Chromedrive.exe and Chrome.exe processes it has launched. For subsequent tests, I will remove that Close.

The Chrome screen then looks like this:

image

If adding the disable search engine choice option:

image

@fredericDelaporte
Copy link
Author

fredericDelaporte commented Aug 27, 2024

So, to summarize a bit:

Driving Chrome 128 through Selenium on a machine without Chrome installed fails connecting to Chrome, be it headless or not, unless asking for headless=old. The disable-search-engine-choice-screen argument does not change anything about this.

It works only if Chrome is directly installed on the machine when not setting --headless=old.

tvdeyen added a commit to solidusio/solidus_starter_frontend that referenced this issue Aug 27, 2024
Since Chrome 128 there is a Search Engine selection
popup even in headless mode that needs to be accepted.
This leads to Capybara Element not found exceptions during
system specs.

Refs: SeleniumHQ/selenium#14438
tvdeyen added a commit to solidusio/solidus_starter_frontend that referenced this issue Aug 27, 2024
Since Chrome 128 there is a Search Engine selection
popup even in headless mode that needs to be accepted.
This leads to Capybara Element not found exceptions during
system specs.

Refs: SeleniumHQ/selenium#14438
tvdeyen added a commit to solidusio/solidus_starter_frontend that referenced this issue Aug 28, 2024
Since Chrome 128 there is a Search Engine selection
popup even in headless mode that needs to be accepted.
This leads to Capybara Element not found exceptions during
system specs.

Refs: SeleniumHQ/selenium#14438
(cherry picked from commit c368c16)
@fredericDelaporte
Copy link
Author

Please elaborate. Your message currently looks like a phishing bot message.

@mamhoff
Copy link

mamhoff commented Sep 9, 2024

We've run into the search engine choice screen as well, and had to disable it manually in our specs (as objects in the center of the viewport would be obscured by that screen). Can that option be made standard for the chrome-headless and chrome drivers in Ruby?

@francecon
Copy link

@fredericDelaporte I had the same issue with Chrome 129 as well. It seems that such error makes just the first browser tab stucked. My test indeed opens other tabs as well, and all of them work correctly.
I use Python, and as a workaround, I press F5 automatically with pyautogui.press('f5') before loading the website where I want to go. This seems to unstack that tab and everything works again.
You could try something like this.
I also use:

chrome_options.add_experimental_option("excludeSwitches", ['enable-automation']) # to hide "Chrome est contrôlé par un logiciel de test automatisé."
chrome_options.add_argument("--disable-search-engine-choice-screen") # to hide the search engine choice option

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

9 participants
@mamhoff @fredericDelaporte @nvborisenko @francecon @pythonpro7 and others