I am facing an issue where every time I run a test, the “Choose your search engine” screen appears. My browser setup configuration is as follows:
For non-headless mode:
`windowsChromeOptions.AddArgument("--disable-gpu");
windowsChromeOptions.AddArgument("--no-sandbox");
windowsChromeOptions.AddArgument("--disable-search-engine-choice-screen");`
For headless mode:
`headlessChromeOptions.AddArgument("--headless");
headlessChromeOptions.AddArgument("--disable-gpu");
headlessChromeOptions.AddArgument("--disable-search-engine-choice-screen");`
I encountered some tests that required accepting alert pop-ups. Before adding the above argument, these tests were failing, but after adding it, they work fine in headless mode. However, in non-
headless mode, I still need to close the pop-ups manually.
It seems that the argument
headlessChromeOptions.AddArgument("--disable-search-engine-choice-screen");
works in headless mode but not in non-headless mode.
Is there any solution or workaround to prevent the “Choose your search engine” screen from appearing in non-headless mode? I am currently using Chrome version 128 and Chromedriver version 128.
Thank you!