Disable Developer Mode Extensions Warning using Selenium

After Chrome’s new update, we are getting an extension warning pop-up, called Disable Developer Mode Extensions. This pop-up warning message is not like general pop-up which we can handle through Alert(), rather this is something different where we have to add some more lines in our code.

Let me tell you the nature of such extensions, it could be any legit warning message or anything which you have built by yourself or something suspicious in the form of malware. So you should be very careful about warning message from Chrome, like Disable Developer Mode Extensions. This pop-up message is quite un-natural for Selenium and it leads to failure of our test cases.

Recommended Reading: How to launch Chrome Browser in Selenium WebDriver?

What does Google say about Disable Developer Mode Extensions Warning pop-up?

Go to below reference and read the entire discussion on this issues.

Reference: Chromium Bug Community

What is Developer Mode in Google Chrome?

As its name reflects, it will be something related to development activities.

Google Chrome has built-in facilities for debugging and customization. It allows the users and developers to customize as well as to trigger different operational changes to the browser. Google Chrome does not allow its users to download extensions from another web store, so the user may quickly add, modify, optimize and customize other’s extensions in Developer mode.

Disable Developer Mode Extensions

Why does browser pop-up Disable Developer Mode Extensions Warning?

Whenever any user downloads extensions from external sources then Chrome starts displaying disable developer mode extensions warning pop-up message. It injects such message for the sake of your information security only. It is a reminder to review all your external extensions download because it may harm your system which may lead to data theft.

Thus, users have two choices, either disable the warning message or cancel it. If you chose to disable then this warning pop-up message will no longer available to appear while each time you open browser, whereas, if you select cancel then it will be hidden for that session and will re-appear when you open chrome browser with a new session.

We can disable this pop-up manually, but today we will discuss to disable developer mode extensions warning pop-up by using Selenium with Java.

 

How to disable developer mode extensions pop-up in Selenium WebDriver?

In general, we create an instance of ChromeDriver after we set the system property. But, in this case, we create an instance of ChromeOptions and then we pass arguments for disabling developer mode extensions. Once it disables the pop-up then we define the instance of ChromeDriver for proceedings of the test cases.

Below are the commands to disable developer mode extensions:

 System.setProperty("webdriver.chrome.driver", "C:\\Selenium\\chromedriver.exe");
	  
	  //Instance of ChromeOptions
	  ChromeOptions options = new ChromeOptions();
	  //Arguments to disable developer mode extensions pop-up
	  options.addArguments("--disable-extensions");
	  //WebDriver starts by passion options as parameter
	  WebDriver driver = new ChromeDriver(options);

 

The entire test code snippet is below:

package SeleniumTester;

import java.util.concurrent.TimeUnit;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.testng.annotations.Test;

public class DisableDeveloperModeExtensions {
  @Test
  public void dropdown() throws InterruptedException {
	  System.setProperty("webdriver.chrome.driver", "C:\\Selenium\\chromedriver.exe");
	  
	  //Instance of ChromeOptions
	  ChromeOptions options = new ChromeOptions();
	  //Arguments to disable developer mode extensions pop-up
	  options.addArguments("--disable-extensions");
	  //WebDriver starts by passion options as parameter
	  WebDriver driver = new ChromeDriver(options);
	  
	  driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
	  
	  driver.get("https://www.inviul.com");
	  
	  driver.manage().window().maximize();
	
	  driver.close();
	  
	  driver.quit();
	  
  }
}

 

 

One Response

Leave a Reply