Skip to content

Disable Chrome Search Engine Choice Dialog in Selenium Tests

Problem

Starting with Chrome version 127, automated test runs using Selenium face a new interruption: the "Choose your search engine" dialog appears at browser launch. This dialog conflicts with automated testing workflows because:

  1. It appears during every test execution due to Selenium using fresh browser profiles
  2. It blocks test execution until manually dismissed
  3. It causes test failures by interrupting page interactions
  4. It doesn't appear in regular Chrome usage once dismissed, creating false confidence

Choose your search engine dialog

Solution

The --disable-search-engine-choice-screen Chrome flag suppresses this dialog. Add this command-line argument through ChromeOptions in your Selenium setup to prevent the dialog from appearing. This solution works for both normal and headless Chrome modes.

Code Implementation

C# Solution

csharp
ChromeOptions options = new ChromeOptions();
options.AddArgument("--disable-search-engine-choice-screen");

// Optional: Headless mode configuration
if (isHeadless)
{
    options.AddArgument("--headless=new");
}

IWebDriver driver = new ChromeDriver(options);

Java Solution

java
ChromeOptions options = new ChromeOptions();
options.addArguments("--disable-search-engine-choice-screen");

// Headless mode example
if (configuration.isHeadless()) {
    options.addArguments("--headless=new");
}

WebDriver driver = new ChromeDriver(options);

Python Solution

python
from selenium import webdriver
from selenium.webdriver.chrome.options import Options

chrome_options = Options()
chrome_options.add_argument("--disable-search-engine-choice-screen")

# For headless mode
# chrome_options.add_argument("--headless=new")

driver = webdriver.Chrome(options=chrome_options)

Ruby Solution

ruby
# For Rails system tests
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
  driven_by :selenium, using: :chrome do |driver_options|
    driver_options.add_argument("--disable-search-engine-choice-screen")
  end
end

# For plain Selenium
options = Selenium::WebDriver::Chrome::Options.new
options.add_argument('--disable-search-engine-choice-screen')
driver = Selenium::WebDriver.for :chrome, options: options

Explanation

How the Solution Works

The --disable-search-engine-choice-screen flag tells Chrome to skip the search engine selection dialog during first-run experiences. This is crucial for automated tests because:

  1. Selenium uses temporary browser profiles for each test session
  2. Each fresh profile triggers Chrome's first-run behavior
  3. The flag disables the dialog globally for the browser instance

Compatibility Considerations

  • Works in Chrome v127+
  • Compatible with Selenium 4.x+
  • Effective for both Windows and Linux test environments
  • Functions correctly in headless mode (--headless=new)

Best Practices

  1. Always match ChromeDriver and Chrome browser versions
  2. Prefer adding the flag unconditionally in testing environments
  3. Combine with other test-friendly flags to minimize UI distractions:
    csharp
    options.AddArguments(
        "--disable-search-engine-choice-screen",
        "--disable-infobars",
        "--disable-extensions",
        "--disable-notifications"
    );

Verified Chrome Flags

For a complete reference of Chrome command-line flags suitable for automation, see Google's official documentation:
Chrome Flags for Tools

Test Execution Note: After implementing this solution, ensure Chrome launches without the dialog blocking interactions. If using cloud testing providers, check their documentation for browser configuration options matching your language approach.