Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
511 views
in Technique[技术] by (71.8m points)

c# - Unable to hide "Chrome is being controlled by automated software" infobar within Chrome v76

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);
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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

     "goog:chromeOptions": {

        "excludeSwitches": [ "enable-automation" ],
        "useAutomationExtension": false
     }

In C# :

To disable pop up "Disable developer mode extensions" and automation info-bar message .

options.AddExcludedArgument("enable-automation");
options.AddAdditionalCapability("useAutomationExtension", false);

In JAVA :

options.setExperimentalOption("excludeSwitches", Collections.singletonList("enable-automation"));
options.setExperimentalOption("useAutomationExtension", false);

In Python :

options.add_experimental_option("excludeSwitches", ["enable-automation"])
options.add_experimental_option('useAutomationExtension', False)

In Protractor :

Add below capabilities in conf.js/conf.ts

capabilities: {
    'browserName': 'chrome',
    "goog:chromeOptions": {
      "excludeSwitches": [ "enable-automation" ],
      "useAutomationExtension": false
   }
  },

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...