After updating Chrome to version 76, I cannot figure out how to hide the "Chrome is being controlled by automated software..." notification overriding some controls on the page.
The latest stable release of ChromeDriver is indeed 76.0.3809.68. The following code worked with Chrome 75 and ChromeDriver 74.
var options = new ChromeOptions();
options.AddArgument("--test-type");
options.AddArgument("--disable-extensions");
options.AddArguments("disable-infobars");
options.AddArguments("--disable-notifications");
options.AddArguments("enable-automation");
options.AddArguments("--disable-popup-blocking");
options.AddArguments("start-maximized");
var driver = new ChromeDriver(driverLocation, options, ScriptTimeout);
This will work in C#:
To hide "Chrome is being controlled by automated test software" infobar in C# for Chrome v76:
Apparently you can use the CommandLineFlagSecurityWarningsEnabled chrome policy - https://www.chromium.org/administrators/policy-list-3#CommandLineFlagSecurityWarningsEnabled
On Linux I was able to create a file at /etc/opt/chrome/policies/managed/managed_policies.json with the contents:
{"CommandLineFlagSecurityWarningsEnabled": false}
and this disabled the warning.On Windows 10 Pro when I set the Chrome group policy "Enable security warnings for command-line flags" to disabled (see https://support.google.com/chrome/a/answer/187202) and check the registry at Software\Policies\Google\Chrome\CommandLineFlagSecurityWarningsEnabled for a value of 0x00000000 it doesn't work for me to disable this warning. Maybe it will for you? Wondering if someone else can help shed light on why it won't work on Windows
As of 1 Aug 2019 - You can send the excludeswitch - enable-automation to hide the message. and to disable pop up 'Disable developer mode extensions' set useAutomationExtension=false . Refer for useAutomationExtension
Tested on : Windows 10 Version 76.0.3809.87 (Official Build) (64-bit) ChromeDriver 76.0.3809.68
--enable-automation : Inform users that their browser is being controlled by an automated test Reference
In C# :
To disable pop up "Disable developer mode extensions" and automation info-bar message .
In JAVA :
In Python :
In Protractor :
Add below capabilities in conf.js/conf.ts
Chromium team earlier introduced the infobar
Chrome is being controlled by automated test software
to disableDeveloper mode extension
popup within Chrome Browser through this commit.As per the discussion Flakiness due to Chrome automation infobar (Chrome 57+) with the addition of the infobar to display if a session is being controlled by an automated test within Chrome it was observed that the presence of Chrome automation infobar
Chrome is being controlled by automated test software
intermitently caused theclick()
function to fail. During the tests, when the the infobar was removed by passingdisable-infobars
withinchrome_launcher.cc
then the above tests runs as expected without any issues. gmanikpure@chromium.org confirmed that the culprit was the changelog:It was observed that, during a click the infobar animation occurs and we got flaky results. So Chromium team needed to detect this change somehow and recompute the position. The actual problem was, if a Page.frameResized occured we can invalidate the results of some operations and retry (e.g. get element position) but there were other operations that can modify the page, such as mouse clicks. It's possible that a mouse click (which involves a mousemove, mousedown and a mouseup event) can have a resize event in the middle.
Accordingly, Chromium team released a revision through this commit:
Since then Chrome user, to disable the infobar started using:
Java:
Python:
C#:
Now in the discussion Chrome is being controlled by automated test software infobar doesn't gets suppressed despite using disable-infobars argument Chromium team member triciac@chromium.org clearly mentioned:
The change was already mentioned in the Release Notes and Chrome Enterprise release notes as follows
So, from Chrome v76.x onwards
--disable-infobars
flag is officially deprecated.Conclusion
The policy is not an option or a capability that is set when ChromeDriver or Chrome is launched as security policies are typically managed by your corporate IT department. Hence usage of
disable-infobars
have been deprecated.A small Hack
The
--disable-infobars
flag can still removed from Chrome v76.x using these 2(two) ExperimentalOption:Excluding
the switches forenable-automation
useAutomationExtension
toFalse
Implementations
Here are the implementations:
Java:
Python:
Outro
As per the article CommandLineFlagSecurityWarningsEnabled: