Since the latest release of chrome (34.0.1847.116) last week, I have been receiving the “Disable developer mode extensions" when running automated tests using watir-webdriver.
This seems to be the offensive extension but it doesn't make sense to me that this is a potentially hazardous extension given its used by the chromedriver.
Anyone that has found a fix for this, as i am unable to roll back to the previous version or find an installer for an older version to roll back to and this is playing havoc with my tests.
This question is related to
google-chrome
google-chrome-extension
watir-webdriver
selenium-chromedriver
As of May 2015 Chrome beta/dev/canary on Windows (see lines 75-78) always display this warning.
I've just patched chrome.dll (dev channel, 32-bit) using hiew32 demo version: run it, switch to hex view (Enter key), search for ExtensionDeveloperModeWarning (F7) then press F6 to find the referring code, go to nearby INC EAX line, which is followed by RETN, press F3 to edit, type 90 instead of 40, which will be rendered as NOP (no-op), save (F9).
Simplified method found by @Gsx, which also works for 64-bit Chrome dev:
Enter
key)F7
)F3
to edit and replace the first letter "E" with any other characterF9
). patch.BAT
script
Of course this will last only until the next update so whoever needs it frequently might write an auto-patcher or a launcher that patches the dll in memory.
This question is enormously old but is still the top result on google when you search for ways to try to disable this popup message as an extension developer who hasn't added their extension to the chrome store, doesn't have access to group policies due to their OS, and is not using the chrome dev build. There is currently no official solution in this circumstance so I'll post a somewhat 'hacky' one here.
This method has us immediately create a new window and close the old one. The popup window is associated with the original window so in normal use cases the popup never appears since that window gets closed.
The simplest solution here is we create a new window, and we close all windows that are not the window we just created in the callback:
chrome.windows.create({
type: 'normal',
focused: true,
state: 'maximized'
}, function(window) {
chrome.windows.getAll(function(windows) {
for (var i = 0; i < windows.length; i++) {
if (windows[i].id != window.id) {
chrome.windows.remove(windows[i].id);
}
}
});
});
Additionally we can detect how this extension is installed and only run this code if it is a development install (although probably best to completely remove altogether from release code). First we create the callback function for a chrome.management.getSelf call which allows us to check the extension's install type, which is basically just wrapping the code above in an if statement:
function suppress_dev_warning(info) {
if (info.installType == "development") {
chrome.windows.create({
type: 'normal',
focused: true,
state: 'maximized'
}, function(window) {
chrome.windows.getAll(function(windows) {
for (var i = 0; i < windows.length; i++) {
if (windows[i].id != window.id) {
chrome.windows.remove(windows[i].id);
}
}
});
});
}
}
next we call chrome.management.getSelf with the callback we made:
chrome.management.getSelf(suppress_dev_warning);
This method has some caveats, namely we are assuming a persistent background page which means the code runs only once when chrome is first opened. A second issue is that if we reload/refresh the extension from the chrome://extensions page, it will close all windows that are currently open and in my experience sometimes display the warning anyways. This special case can be avoided by checking if any tabs are open to "chrome://extensions" and not executing if they are.
The official way to disable the popup is this:
Pack your extension: go to chrome://extensions
, check Developer mode and click Pack extension
Install the extension by dragging and dropping the .crx
file into the chrome://extensions
page.
You'll get an "Unsupported extensions disabled" popup if you try restarting Chrome at this point.
Then for Windows 7 or Windows 8:
[zip]\windows\admx\chrome.admx
to c:\windows\policydefinitions
[zip]\windows\admx\[yourlanguage]\chrome.adml
to c:\windows\policydefinitions\[yourlanguage]\chrome.adml
(not c:\windows\[yourlanguage]
)chrome://extensions
gpedit.msc
and hit enter.That's it!
Chrome Version 69.0.3497.100 (Official Build) (64-bit)
:Temporarily enable Developer mode in chrome://extensions
Uninstall the extension that causes the popup using the Load unpacked.
Click on Pack extension, and find and select the folder containing the extension files. Don't enter the private key file if you don't have it.
Click Pack extension. A .crx
and .pem
file will be created near the root directory of the extension. Install the extension using the .crx
file and keep the .pem
file safe.
Copy the .crx
installed extension ID to the whitelist and restart Chrome.
The popup should be gone.
I'm not sure if this is still a problem for people or not. However, I read through this post and several others and finally played around with this and was able to make it work in C# using this code. I derived it all from this post and possible some posts linked to this post.
I hope this helps, it certainly solved my problems in C# console application.
Using version 52.0.2743.116 m of Chrome Selenium 2.9 Server Driver
var chromeService = ChromeDriverService.CreateDefaultService(@"C:\Selenium\InstalledServerDrivers\");
var options = new ChromeOptions();
options.AddArgument("--disable-extensions");
IWebDriver driver = new ChromeDriver(chromeService, options);
driver.Url = "http://www.google.com/";
Can't be disabled. Quoting: "Sorry, we know it is annoying, but you the malware writers..."
Your only options are: adapt your automated tests to this new behavior, or upload the offending script to Chrome Web Store (which can be done in an "unlisted" fashion).
Now, we need to handle it using following -
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.addArguments("chrome.switches", "--disable-extensions --disable-extensions-file-access-check --disable-extensions-http-throttling");
Apart from --disable-extensions
, we also need to add --disable-extensions-file-access-check
(and/or) --disable-extensions-http-throttling
chrome switches.
There is an alternative solution, use Chrome-Developer-Mode-Extension-Warning-Patcher:
1) Wait for the popup balloon to appear.
2) Open a new tab.
3) Close the a new tab. The popup will be gone from the original tab.
A small Chrome extension can automate these steps:
manifest.json
{
"name": "Open and close tab",
"description": "After Chrome starts, open and close a new tab.",
"version": "1.0",
"manifest_version": 2,
"permissions": ["tabs"],
"background": {
"scripts": ["background.js"],
"persistent": false
}
}
background.js
// This runs when Chrome starts up
chrome.runtime.onStartup.addListener(function() {
// Execute the inner function after a few seconds
setTimeout(function() {
// Open new tab
chrome.tabs.create({url: "about:blank"});
// Get tab ID of newly opened tab, then close the tab
chrome.tabs.query({'currentWindow': true}, function(tabs) {
var newTabId = tabs[1].id;
chrome.tabs.remove(newTabId);
});
}, 5000);
});
With this extension installed, launch Chrome and immediately switch apps before the popup appears... a few seconds later, the popup will be gone and you won't see it when you switch back to Chrome.
Using selenium with Python, you start the driver with extensions disabled like this:
from selenium import webdriver
options = webdriver.chrome.options.Options()
options.add_argument("--disable-extensions")
driver = webdriver.Chrome(chrome_options=options)
The popup 'Disable developer mode extensions' will not pop up.
Unfortunately I cant automate setting it to developer mode because of restrictions in width using the browser in iphone mode. I have found a dangerous workaround for now, install the dev channel version of chrome. It does not have the warning message, but im sure it will cause me more problems in the long run when problems are introduced. Still will hopefully give me a few days to find a workaround.
Have you tried using the Developer Mode Extension Patcher on Github?
It automatically patches your Chrome/Chromium/Edge browser and hides the warning.
The disable extensions setting did not work for me. Instead, I used the Robot class to click the Cancel button.
import java.awt.Robot;
import java.awt.event.InputEvent;
public class kiosk {
public static void main(String[] args) {
// As long as you don't move the Chrome window, the Cancel button should appear here.
int x = 410;
int y = 187;
try {
Thread.sleep(7000);// can also use robot.setAutoDelay(500);
Robot robot = new Robot();
robot.mouseMove(x, y);
robot.mousePress(InputEvent.BUTTON1_MASK);
robot.mouseRelease(InputEvent.BUTTON1_MASK);
Thread.sleep(3000);// can also use robot.setAutoDelay(500);
} catch (AWTException e) {
System.err.println("Error clicking Cancel.");
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
Based on Antony Hatchkins's answer:
The official way to disable the popup seems to be like this:
Pack your extension (chrome://extensions/
, tick at 'Developer mode', hit 'Pack extension...') and install it via drag-and-dropping the .crx
file into the chrome://extensions
page.
(Since the extension is not from Chrome Web Store, it will be disabled by default.)
Then for Windows:
nmgnihglilniboicepgjclfiageofdfj
Start
> Run
, and type regedit
<ENTER>
HKLM\Software\Policies\Google\Chrome\ExtensionInstallWhitelist
(create it if not exists), create a new string for each extension you want to enable with sequential names (indices), e.g. 1, 2, ...1
and value nmgnihglilniboicepgjclfiageofdfj
That's it!
Note: When you update a whitelisted extension, you do not have to follow the same steps since the ID of the extension will not change.
I found something that will load user-packed extensions and works beautifully:
You'll still have to pack it in details for the problem extension, but after that you can turn off developer mode and load the packed CRX through this. You don't have to deal with signing it or anything.
https://chrome.google.com/webstore/detail/crosspilot/migomhggnppjdijnfkiimcpjgnhmnale?hl=en
Note: I'm not from their team, I've just been looking for an elegant solution for this for years.
(In reply to Antony Hatchkins)
This is the current, literally official way to set Chrome policies: https://support.google.com/chrome/a/answer/187202?hl=en
The Windows and Linux templates, as well as common policy documentation for all operating systems, can be found here: https://dl.google.com/dl/edgedl/chrome/policy/policy_templates.zip (Zip file of Google Chrome templates and documentation)
Instructions for Windows (with my additions):
Open the ADM or ADMX template you downloaded:
- Extract "chrome.adm" in the language of your choice from the "policy_templates.zip" downloaded earlier (e.g. "policy_templates.zip\windows\adm\en-US\chrome.adm").
- Navigate to Start > Run: gpedit.msc.
- Navigate to Local Computer Policy > Computer / User Configuration > Administrative Templates.
- Right-click Administrative Templates, and select Add/Remove Templates.
- Add the "chrome.adm" template via the dialog.
- Once complete, Classic Administrative Templates (ADM) / Google / Google Chrome folder will appear under Administrative Templates.
- No matter whether you add the template under Computer Configuration or User Configuration, the settings will appear in both places, so you can configure Chrome at a machine or a user level.
Once you're done with this, continue from step 5 of Antony Hatchkins' answer. After you have added the extension ID(s), you can check that the policy is working in Chrome by opening chrome://policy
(search for ExtensionInstallWhitelist).
I was suffering from the same problem, and I tried the following:
A few things to note:
When I reopened Chrome, I got a popup that told me about the new packed extension, so I rebooted Chrome to see if it would do it again, and it did not.
I hope this solution worked!
For anyone using WebdriverIO, you can disable extensions by creating your client like this:
var driver = require('webdriverio');
var client = driver.remote({
desiredCapabilities: {
browserName: 'chrome',
chromeOptions: {
args: [
'disable-extensions'
]
}
}
});
Ruby based watir-webdriver use something like this:
browser=Watir::Browser.new( :chrome, :switches => %w[ --disable-extensions ] )
While creating chrome driver, use option to disable it. Its working without any extensions.
Use following code snippet
ChromeOptions options = new ChromeOptions();
options.addArguments("chrome.switches","--disable-extensions");
System.setProperty("webdriver.chrome.driver",(System.getProperty("user.dir") + "//src//test//resources//chromedriver_new.exe"));
driver = new ChromeDriver(options);
I am working on Windows And I have tried lots of things provided here as answer but Pop up was disabling the extension continually then i have tried following steps and it works now:
Pack extension
button and select your root Directory of extension by clicking on red rectangled browse button displayed in below image.Pack extension
button displayed in red circle in below image.Now in check parent directory
of your selected root directory
of extension, 2 file would have created [extension name].crx
and [extension name].pem
.
Now just drag and drop the [extension name].crx
file onto the chrome://extensions page and it will ask using add app dialog box click on Add app
and refresh the page it is installed now.
Note: Before doing anything as above make sure to enable Developer mode for extensions. If this was not enabled, refresh the chrome://extensions page after enabling it.
Source: Stackoverflow.com