ChromeDriver - Disable developer mode extensions pop up on Selenium WebDriver automation
Asked Answered
S

11

36

I'm having the following issue: When I'm running my automation tests, I keep getting the following alert "Disable Developer Mode Extension" in Chrome.

enter image description here

Is there a way to remove/disable this?. It is a blocker for me as it is making me fail some tests.

Thanks in advance

Savoirvivre answered 15/4, 2014 at 15:8 Comment(8)
That popup shouldn't be opening unless you open the Developer tools, which you shouldn't be doing anyway.Thymic
I have no extension on chrome that is the wierd thing. Also I have the latest version of chrome.Savoirvivre
I didn't say that - I asked are you opening the developer tools within Chrome?Thymic
Nope I'm just navigating through a couple pages doing some automated tests and then the pop up appears.Savoirvivre
Go to chrome://extensions in Chrome -> what's listed? Not in the Chrome opened by Selenium but in your own instance.Thymic
In my own instance on Chrome say that there are no extension installed.Savoirvivre
If you click the Learn more link, it will show that it is the Chrome Automation Extension that is causing the dialog to appear. I've been trying to figure a way around this since Chrome 34 released, without any success.Advert
I've run into this, I'm assuming it's the chromedriver that is automatically running an extension called Chrome Automation Extension. That's the extension I'm seeing when running the automated tests. @Mauricio's solution works, but if you have a need to use the extension I'm sure any other solution to dismiss the warning would be appropriate as well. I've briefly looked at it, but it seems the extension adds the ability to listen for some events and some other cool stuff that might help with automation.Kotick
I
56

Did you try disabling the developer extensions with command line param?

Try with the following Selenium WebDriver java code:

System.setProperty("webdriver.chrome.driver", "D:\\chromedriver.exe");
ChromeOptions options = new ChromeOptions();
options.addArguments("--disable-extensions");
driver = new ChromeDriver(options);
Intervention answered 22/4, 2014 at 20:50 Comment(4)
Okay, this code does work but always make sure to have the latest ChromeDriver installed!Hardwood
Does not seem to help in the latest ChromeDriver (2.29), and the --disable-extensions is not listed in the Chrome/ChromeDriver docs.Katar
This worked yesterday, today, after windows update, it no longer works.Resinoid
Make sure that the chrome driver version is compatible with the Chrome browser version. Otherwise it may not work.Chromato
L
8

I cannot disable extensions because I'm developing & testing one.

What I'm doing to dismiss this popup is the following:

  1. I load chrome with my extension using Selenium.
  2. I then immediately create a new window (via the SendKeys(Control-N) method). This predictably brings up the "Disable Developer Mode Extensions" popup after 3 seconds in the new window.
  3. I can't tell programmatically when it pops up (doesn't show in screenshots) so instead I simply wait 4 seconds.
  4. Then I close the tab via driver.Close(); (which also closes this new window). Chrome takes that as "cancel", dismissing the popup, leaving the original window and tab.

I find this necessary because the popup interferes with normal selenium browser interaction, like SendKeys, which I'm using to switch tabs and windows.

Labroid answered 8/4, 2016 at 18:53 Comment(0)
R
6

As of Chromedriver v2.33, the correct way to avoid this message is to pass load-extension to the excludeSwitches argument of the chromeOptions object. The following Java code should do the trick, although I haven't tested it, as I am running Python:

ChromeOptions options = new ChromeOptions();
options.setExperimentalOption("excludeSwitches", Collections.singletonList("load-extension"));

As others have pointed out, the culprit is probably the Chrome Automation Extension, which is loaded automatically by Chromedriver when it launches Chrome.

Chromedriver v2.33 introduced the new switch to prevent the extensions from being loaded:

Updates to excludeSwitches capability that now allows to exclude --load-extension switch.

I suspect that this solution does not require you to disable all extensions. You should still be able to manually load others.

Rehearing answered 26/7, 2018 at 16:32 Comment(0)
M
3

This has been automatically fixed with a combination of ChromeDriver.exe V2.23 + Chrome 53.0.

To understand which chrome version will work with which driver, we can use the following well detailed doc: https://sites.google.com/a/chromium.org/chromedriver/downloads

Enjoy Automated Testing!!

Miguelmiguela answered 6/9, 2016 at 12:37 Comment(1)
I was able to lose the popup on Chrome v52.0.2743.116 by using ChromeDriver v2.23 as well.Longhorn
A
2

I worked around this issue by using AutoIT.

First, you'll need to create the script.

closechromewarning.au3:

WinWaitActive("[CLASS:Chrome_WidgetWin_1]")
Send("{ESC}")

The script needs to be compiled to a .exe, then place the .exe in the path so it can be run.

Function that closes the warning, using c# syntax:

public void CloseChromeDialog()
{
    System.Threading.Thread.Sleep(5000);
    Process.Start(@".\closechromewarning.exe");
}

Sleep(4000) did work, but I upped it to Sleep(5000) just to be sure.

Calling CloseChromeDialog():

if(browser == chrome) //pseudo code
    CloseChromeDialog();
Advert answered 21/4, 2014 at 19:4 Comment(2)
Thanks works great not the solution it would like but the only one that works, until google fixes Chrome issueSavoirvivre
@Savoirvivre Agreed. I have tried a lot of different approaches to work around the issue, and this is the only one so far that has worked.Advert
G
2

resolved in chrome 54 and chromedriver 2.25

Gertiegertrud answered 13/11, 2016 at 18:57 Comment(0)
C
0

I too faced this problem. The solution is, if you are using maven then just add:

-Dchrome.switches=--disable-extensions

It will disable all the extensions and you will not face this problem.

Contrabassoon answered 21/7, 2016 at 13:44 Comment(0)
H
0

I am using selenium Webdriver 2.53 and chrome version 56.0.2924.87 and the chrome driver.exe which I am using is 2.27. with this combination it is working with the

System.setProperty("webdriver.chrome.driver", "./utilities/chromedriver.exe");          
ChromeOptions options = new ChromeOptions();        
options.addArguments("--disable-extensions");           
DesiredCapabilities caps = new DesiredCapabilities().chrome();
caps.setCapability(ChromeOptions.CAPABILITY, options);
driver = new ChromeDriver(caps);
Hydrolysate answered 25/2, 2017 at 19:2 Comment(1)
It doesn't work for me with Chrome 57.0.2987.133 and chromedriver.exe 2.29. My initialization: ChromeOptions options = new ChromeOptions(); options.addArguments("--disable-extensions"); options.setExperimentalOption("prefs", prefs); options.setExperimentalOption("excludeSwitches", Collections.singletonList("enable-automation")); DesiredCapabilities capabilities = DesiredCapabilities.chrome(); capabilities.setCapability(ChromeOptions.CAPABILITY, options);Hush
S
0

Try to add setProperty above ChromeDriver instance

System.setProperty("webdriver.chrome.driver","C:/[PATH]/chromedriver.exe");
driver = new ChromeDriver(capabilities);
Sylviesylvite answered 28/5, 2017 at 5:56 Comment(0)
M
0

pywinauto works

import pywinauto
window_title = "Disable Developer Mode Extensions"
app = pywinauto.Application().connect(name_re=window_title)
win_ext = app.window(name=window_title)
win_ext.close()
Misunderstood answered 20/10, 2022 at 8:7 Comment(0)
S
-1

This is because one of your extensions is running in developer mode. Go through your extension list and disable extensions one-by-one until you find the culprit(s).

Scaphoid answered 15/4, 2014 at 15:22 Comment(8)
The thing is I don't have any extensions on my chromedriver nor on my chrome browser. Here is how I init chromedriver: ChromeOptions options = new ChromeOptions(); options.addArguments("--lang=es"); driver = new ChromeDriver(options);Savoirvivre
And you have no extensions installed in Chrome at all?Scaphoid
No none at all. I use firefox to surf the web, Chrome is just for the automation tests. That pop up isn't an alert that blocks your browser. And googled for solutions but couldn't find anything its wierd. I'm running chromedriver 2.9Savoirvivre
That is weird. Are you running the latest version of Chrome?Scaphoid
Yeah the latest version is the 2.9. chromedriver.storage.googleapis.com/index.htmlSavoirvivre
Not the driver, the browser.Scaphoid
Sorry, yeah the latest version 34.0.1847.116Savoirvivre
Well I'm stumped then, sorry.Scaphoid

© 2022 - 2024 — McMap. All rights reserved.