Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to hide “Chrome is being controlled by automated software” infobar within Chrome v76

This is not really a new question, nor an answer to the original question, but is rather a request for clarrity since the answer posted to the original question is incomplete, but any request for clarrity gets deleted...

Original post is here... Unable to hide "Chrome is being controlled by automated software" infobar within Chrome v76

So, while I understand your original answer, we do not use managed instances of Chrome, and we all run on Windows 10 Home Edition... so, this setting your answer is not an option for us. On the other hand, all of our regression tests are failing now because this stupid banner is in the way of everything.

Is there a way a non-IT-Managed user running Windows 10 Home Edition can suppress this banner?

If not, how does Google expect us to continue using Chrome for testing? Any suggestions greatly appreciated... Also, I am using Python, so if you supply code example, please keep that in mind... this is what I am currently doing, and it was working before last week, but not working now...

options = webdriver.ChromeOptions()

options.add_argument('--start-maximized')
options.add_argument("--disable-infobars")
options.add_argument("--disable-extensions")
options.add_argument("--disable-automation")

options.add_argument("--log-level=3")
# options.add_argument('headless')
options.add_argument('window-size=1920x1012')
options.add_experimental_option("prefs", {"download.prompt_for_download": False})
options.add_experimental_option("prefs", {"plugins.plugins_list": [{"enabled": False, "name": "Chrome PDF Viewer"}]})
options.add_experimental_option("prefs", {"download.default_directory": os.path.abspath(context.BaseResultsDir + '/Downloads/')})
options.add_experimental_option("prefs", {"download.extensions_to_open": "applications/pdf"})
context.driver = webdriver.Chrome(chrome_options=options)
like image 689
user3594179 Avatar asked Aug 05 '19 15:08

user3594179


2 Answers

After much Googling, this is finally what worked for me... Updated Selenium, switched to Canary release of ChromeDriver, and then made these adjustments to my test code, which is Python...

# options.add_argument("--disable-infobars")  <<< TOOK THIS OUT
# options.add_argument("--disable-automation")  <<< TOOK THIS OUT

options.add_experimental_option("excludeSwitches", ["enable-automation"])  <<< PUT THIS IN  (Finding this one was the real killer)
options.add_experimental_option("useAutomationExtension", False)  <<< PUT THIS IN

Your solution and mine are very similar. Thank you for posting.

David

like image 192
user3594179 Avatar answered Nov 17 '22 10:11

user3594179


Probably reason behind settings for infobar was working still last week not in this week, are may be you have updated/autoupdated chromedriver or chromebrowser. However your setting to disable infobar are not working because as per this commit on - Jan 10 2018, --disable-infobars option has been removed from chrome options

Solutions - Keeping this line does nothing options.add_argument("--disable-infobars") you can remove it.

  1. options.add_argument("--disable-automation")

This line makes real confusion here towards the solution because there are 2 different ways to do it (By default this switch is enabled we have to remove it to disable the infobar). This line disables the password saving UI for more details read this nice discussion

  1. Use this line do disable the infobar by excluding enable automation switch -

    options.add_experimental_option("excludeSwitches" , ["enable-automation"])
    It solves the problem to some extent, when I tried with this intermittently developer code plugin popup comes up and ask to enable/disable it. and it wont go away by options.add_argument("--disable-extensions") this. If you facing same issue use another switch to disable it as below-

  2. options.add_experimental_option("excludeSwitches" , ["enable-automation","load-extension"])

This solves the problem from root(load-extension switch supports Chromedriver v2.33 and later). However there is one more way to disable the developer code plugin popup which you can do by adding --disable-plugins into shortcut of chrome

  1. If these solutions doesn't work for you then chromium command line switches here can help you to customize the chrome behavior

    Additionaly ChromeDriver(Capabilities capabilities) is deprecated and can be used as

    capabilities = DesiredCapabilities.CHROME.copy() capabilities.update(options.to_capabilities())

    driver = webdriver.Chrome(chromedriver, desired_capabilities=capabilities)

solution to disable infobar in Java

options.setExperimentalOption("excludeSwitches", Arrays.asList("enable-automation" , "load-extension"));

will disable infobar with developer code plugin

like image 2
Dev Avatar answered Nov 17 '22 10:11

Dev