Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 592
elcharrua Avatar asked Apr 15 '14 15:04

elcharrua


People also ask

How do I disable developer mode extensions popup?

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.

Which of the following Selenium code is used to disable plugins and extensions while launching Chrome browser?

addArguments("--disable-extensions"); // Start the chrome session WebDriver driver = new ChromeDriver(options);


2 Answers

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); 
like image 83
Mauricio Avatar answered Sep 20 '22 11:09

Mauricio


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.

like image 23
Erik Eidt Avatar answered Sep 19 '22 11:09

Erik Eidt