Sunday, April 1, 2018

Loading of unpacked extensions is disabled by the administrator

While launching chrome browser using selenium chrome driver, you may have seen below popup message sometime. This popup message will not allow you to load web browser for test execution, so here we are providing workaround to hide this popup message.

Loading of unpacked extensions is disabled by the administrator

Use the below method to disable the popup message using chromeOptions of selenium webdriver.



Method -1 :
ChromeOptions option = new ChromeOptions();
option.addArguments("disable-extensions");  
driver = new ChromeDriver(option);

Method -2 :
ChromeOptions option = new ChromeOptions();
option.setExperimentalOption("useAutomationExtension", false);  
driver = new ChromeDriver(option);

Lets see the complete example to disable popup message (Loading of unpacked extensions is disabled by the administrator)
SeleniumDemo.java
package demoPackage;

import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.Point;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;

public class SeleniumDemo {

 public static WebDriver driver;
 
 public static void main(String[] args) {
  // TODO Auto-generated method stub
  
  System.out.println("Launching the chrome driver  ");
  
  //using chrome options
  ChromeOptions option = new ChromeOptions();
  //option.addArguments("disable-extensions"); 
  //OR
  option.setExperimentalOption("useAutomationExtension", false);
  
  // Set the chrome driver exe file path
  System.setProperty("webdriver.chrome.driver","E:\\selenium_sumit\\chromedriver_win32_2.33\\chromedriver.exe");
  
  // Instantiate the chrome driver
  driver = new ChromeDriver(option);
  
  // set the browser URL in get() to load the webpage
     driver.get("https://google.com/");     

 } 

}

Console output :
Loading of unpacked extensions is disabled by the administrator




No comments:

Post a Comment