[Java] How to turn off ChromeDriver notification bar (Java)

less than 1 minute read

How to remove the “controlled by automated test software” notification bar in Selenium (ChromeDriver)

|Untitled.png|
|:–|
This display is an obstacle, isn’t it?

Do you want to disable developer mode when you turn off the notification bar? Popped up
I couldn’t find a way to do it, but I was able to turn off the notification bar with a matching technique, so I’ll wake it up in the article.

import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;

ChromeOptions options = new ChromeOptions();
options.setExperimentalOption("excludeSwitches", new String[] { "enable-automation" });
options.setExperimentalOption("useAutomationExtension", false);
WebDriver driver = new WebDriver(options);

Hiding the password save popup
WebDriver driver = new WebDriver(options);
You can do this by adding the following code just before.

Map<String, Object> prefs = new HashMap<String, Object>();
prefs.put("credentials_enable_service", false);
prefs.put("profile.password_manager_enabled", false);
options.setExperimentalOption("prefs", prefs);

By writing this entirely in the code, the notification bar disappears brilliantly.