ChromeDriver - Disable developer mode extensions p

2019-01-06 19:48发布

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

11条回答
ら.Afraid
2楼-- · 2019-01-06 19: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);
查看更多
家丑人穷心不美
3楼-- · 2019-01-06 19:58

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();
查看更多
老娘就宠你
4楼-- · 2019-01-06 20:00

I'd been facing the same problem for a long time. The solution turns out to be very simple. Just download the updated "chromedriver.exe" and paste it replacing with the existing one located at "C:\Program Files\SeleniumBasic". I hope it'll do the trick.

查看更多
霸刀☆藐视天下
5楼-- · 2019-01-06 20:02

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!!

查看更多
\"骚年 ilove
6楼-- · 2019-01-06 20:09

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.

查看更多
家丑人穷心不美
7楼-- · 2019-01-06 20:13

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);
查看更多
登录 后发表回答