System.setProperty("webdriver.chrome.driver", "D:\\chromedriver.exe");
ChromeOptions options = new ChromeOptions();
options.addArguments("--disable-extensions");
driver = new ChromeDriver(options);
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);
The official way to disable the popup seems to be like this:
Pack your extension and install it via drag-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 stage)
Then for Win7/8:
- Download Chrome group policy templates from:
http://dl.google.com/dl/edgedl/chrome/policy/policy_templates.zip
- Copy
[zip]\windows\admx\chrome.admx to c:\windows\policydefinitions
- Copy
[zip]\windows\admx\[yourlanguage]\chrome.adml to
c:\windows\policydefinitions\[yourlanguage]\chrome.adml (not c:\windows\[yourlanguage] )
- In Chrome, go to
Settings > Extensions
- Check the Developer Mode checkbox at the top
- Scroll down the list of disabled extensions and note the ID(s) of the extensions you want to enable. LogMeIn, for example, is ID:
nmgnihglilniboicepgjclfiageofdfj
- Click
Start > Run , and type gpedit.msc <ENTER>
- Expand
User Configuration > Administrative Templates > Google Chrome > Extensions
- Double-click to open
Configure extension installation whitelist policy
- Select
Enabled , then click Show...
- In the list, enter the ID(s) of the extensions you noted in Step 7
- Click
OK and restart Chrome.
That's it!
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();
|