23

I have just updated my project with the latest chrome driver (2.28). When I run the browser through the driver, a yellow notification pops under the URL bar, saying "Chrome is being controlled by automated test software". Is there any way to configure Chrome not to show this notification?

I used this code to start the driver:

    ChromeOptions cOptions = new ChromeOptions();
    cOptions.addArguments("test-type");
    cOptions.addArguments("start-maximized");
    cOptions.addArguments("--js-flags=--expose-gc");  
    cOptions.addArguments("--enable-precise-memory-info"); 
    cOptions.addArguments("--disable-popup-blocking");
    cOptions.addArguments("--disable-default-apps"); 
    driver = new ChromeDriver(cOptions);

enter image description here

  • What happens if you try cOptions.addArguments("test-type=browser"); – Michael Durrant Mar 12 '17 at 23:21
  • Also try removing cOptions.addArguments("--disable-default-apps"); and see what happens. – Michael Durrant Mar 12 '17 at 23:24
  • Do you have any idea to disable the info-bar while running script in chrome emulator? – user24909 Mar 30 '17 at 12:06
  • Any ideas how to do it for Robot Framework? – Porris Apr 3 '17 at 12:39

10 Answers 10

17

Just in case someone sees that post , I added :

cOptions.setExperimentalOption("excludeSwitches", Arrays.asList("enable-automation"));

And it caused the driver to crash when calling:

driver().manage().window().maximize();

So I had to remove it. Anyway , Adding :

options.addArguments("disable-infobars");

solved the original issue. Thank you all for your help.

| improve this answer | |
5

Solution for Python 3:

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
chrome_options = Options()
chrome_options.add_argument("--disable-infobars")
browser = webdriver.Chrome(executable_path = path_to_chromedriver,chrome_options=chrome_options)
| improve this answer | |
3

You can use

ChromeOptions options = new ChromeOptions();
options.setExperimentalOption("excludeSwitches", Collections.singletonList("enable-automation"));

Also, it's better to use Collections.singletonList instead of Arrays.asList since we are passing in a single argument to excludeSwitches.

Disabling the infobar using --disable-infobars flag will suppress other useful information in the future and is not recommended as @michaeldurrant suggested.

| improve this answer | |
1

I've managed to do it by passing the "disable-infobars" argument:

ChromeOptions options = new ChromeOptions();
options.addArguments("disable-infobars");
WebDriver player = new ChromeDriver(options);
| improve this answer | |
  • hmm, very global. Might cover up crucial information in the future. – Michael Durrant Mar 13 '17 at 4:22
1

The infobar was added in the most recent Chrome update:

Add an infobar if a session is being controlled by an automated test.

This infobar is only displayed if the browser is launched with the --enable-automation switch. It also disables the developer mode extensions warning bubble.

To disable it, remove the switch like so:

ChromeOptions cOptions = new ChromeOptions();
cOptions.setExperimentalOption("excludeSwitches", Arrays.asList("enable-automation"));
_driver = new ChromeDriver(cOptions);
| improve this answer | |
1
ChromeOptions option = new ChromeOptions();
option.AddArguments("disable-infobars");
driver = new ChromeDriver(option);
| improve this answer | |
  • It does not work with Chrome 65 and Chrome driver 2.33 or 2.36. Do we have any solutions for this case, please ? – Majkl Mar 7 '18 at 14:23
1

Here is a solution for Ruby with Capybara:

Capybara.register_driver :selenium_chrome do |app|
Capybara::Selenium::Driver.new(app, :browser => :chrome, args: ["--disable-infobars"])
end
| improve this answer | |
1

In chrome 57+ and chromedriver 2.28, the execution was not starting when driver.manage().window().maximize(); is used

Solution:

ChromeOptions options = new ChromeOptions();
options.addArguments("-incognito");
options.addArguments("start-maximized");
DesiredCapabilities capabilities = DesiredCapabilities.chrome();    
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
WebDriver webDriver = new <strike>ChromeDriver</strike>(capabilities);//Capabilities is deprecated in latest version 

Don't Use driver.manage().window().maximize();

| improve this answer | |
0

Thanks , I added :

options.addArguments("disable-infobars"); 

I also added :

cOptions.setExperimentalOption("excludeSwitches", Arrays.asList("enable-automation"));

Just to make sure nothing pops in the future. It looks like the problem has been solved.

| improve this answer | |
0

I tried using :

ChromeOptions option = new ChromeOptions();
option.AddArguments("disable-infobars");
driver = new ChromeDriver(browserFolder);

it did not dismiss the pop-up. I'm using selenium webdriver with C#.

| improve this answer | |
  • what is browserFolder and where you pass option? – derloopkat Dec 28 '17 at 18:38

Not the answer you're looking for? Browse other questions tagged or ask your own question.