Karol Majewski
Karol Majewski

Reputation: 253

disable-infobars argument unable to hide the infobar with the message "Chrome is being controlled by automated test software" with ChromeDriver v2.36

I just updated ChromeDriver to newest version - 2.36. In previous versions I've set:

    ChromeOptions options = new ChromeOptions();
    options.addArguments("disable-infobars");

and the "Chrome is being controlled by automated test software" warning bar wasn't displayed. With the same option set, I'm keep seeing it. Do you know how to disable this from appearing in the newest ChromeDriver? Thanks in advance

Upvotes: 3

Views: 6718

Answers (8)

arquillos
arquillos

Reputation: 97

Streamlined solution:

options.setExperimentalOption("excludeSwitches", new String[]{"enable-automation"});

Upvotes: 0

Mahbub shaun
Mahbub shaun

Reputation: 23

A latest working example in Java:

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

Tested in Chrome Version 80

Upvotes: 0

Dan
Dan

Reputation: 31

I was able to get rid of the message by adding the following...

    chromeOptions.AddExcludedArgument("enable-automation")

This in turn causes a popup in Chrome titled "Disable developer mode extensions". I am able to close this popup in VB.NET by calling CloseChromeDialogDisableDeveloperModeExtensions() method below at the appropriate time(s).

I hope this helps!

    Private Declare Auto Function FindWindow Lib "user32.dll" (ByVal lpClassName As String, ByVal lpWindowName As String) As IntPtr
    Private Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" (hWnd As IntPtr, wMsg As Int32, wParam As Int32, lParam As String) As Int32

    Private Sub CloseChromeDialogDisableDeveloperModeExtensions()
        Try
            Const WM_CLOSE As Integer = 16
            Dim popupHandle As IntPtr = FindWindow("Chrome_WidgetWin_1", "Disable developer mode extensions")

            If popupHandle <> New IntPtr(0) Then
                SendMessage(popupHandle, WM_CLOSE, 0, Nothing)
            End If
        Catch ex As Exception
            'swallow exception
        End Try
    End Sub

Upvotes: 3

undetected Selenium
undetected Selenium

Reputation: 193388

You saw it right.

Passing the argument disable-infobars no more suppresses the infobar with text as Chrome is being controlled by automated test software with ChromeDriver v2.36.

As per https://crrev.com/528386 the flag --disable-infobars was removed on Wed Jan 10 19:44:29 2018 as this flag is no longer needed by the perf testing infrastructure and can be misused for malicious purposes, so remove it.

Remove --disable-infobars.

This flag is no longer needed by the perf testing infrastructure and can be
misused for malicious purposes, so remove it.

BUG=none
TEST=none

This change landed with ChromeDriver v2.36 on 2018-03-02 which supported Chrome v63-65. Hence while using ChromeDriver v2.36 the infobar is no more getting supressed.


But as per Infobars cannot be disabled - breaks coordinate assumptions in Selenium tests the --disable-infobars was back on Mar 20 2018.

Solution

With ChromeDriver v2.36 if you are unable to supress the infobar with text as Chrome is being controlled by automated test software, you need to upgrade to ChromeDriver v2.38 of 2018-04-17 which supported Chrome v65-67

Upvotes: 1

Karol Majewski
Karol Majewski

Reputation: 253

New version of ChromeDriver has been released - 2.37. It again supports:

options.addArguments("disable-infobars");

Upvotes: 1

Abhishek Dhoundiyal
Abhishek Dhoundiyal

Reputation: 1417

disable-infobars flag has been removed but you can get rid of the message by adding the following:

ChromeOptions options = new ChromeOptions();
options.setExperimentalOption("useAutomationExtension", false);
options.setExperimentalOption("excludeSwitches",Collections.singletonList("enable-automation"));    
WebDriver driver = new ChromeDriver(options);

This work for me and I hope works for you too.

Upvotes: 2

Walter Fernandes
Walter Fernandes

Reputation: 11

Use this code. It works fine

`ChromeOptions options = new ChromeOptions(); 
        options.addArguments("disable-infobars"); 
        WebDriver driver = new ChromeDriver(options);`

Upvotes: 0

Tomek Brek
Tomek Brek

Reputation: 59

disable-infobars flag has been removed in latest Chrome => https://chromium.googlesource.com/chromium/src/+/d869ab3350d8ebd95222b4a47adf87ce3d3214b1

Upvotes: 5

Related Questions