Forum Discussion

farisk2010's avatar
farisk2010
Copper Contributor
Sep 22, 2020
Solved

Adding Chome Extension to Edge 85 with Selenium Java

 I want to add chrome extension from Selenium Java to Newest Edge Version with msedgedriver. But when the browser instance opens the extension is not getting added and developer mode is not  i. Edg...
  • johnjansen's avatar
    johnjansen
    Sep 22, 2020

    thanks for tagging me, Deleted .

     

    farisk2010 , I think you just have they syntax incorrect for enabling extensions via the current driver design:

    var options = new EdgeOptions();
    options.AddArguments("load-extension=/path/to/extension");

     

    so something like this:

     

    public static WebDriver ini() {
    System.setProperty("webdriver.edge.driver", "D:\\SeleniumTest\\new\\msedgedriver.exe");
    DesiredCapabilities desiredCapabilities = new DesiredCapabilities ();
    EdgeOptions options = new EdgeOptions();
    //ArrayList<String> extensionList=new ArrayList<String>();
    String extensionLocation="C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\85.0.564.51\\Extensions\\CombinedExtension";
    //extensionList.add(extensionLocation);

    options.setCapability( "disable-infobars", true);
    options.setCapability("extensionPaths", extensionList);
    options.AddArguments("load-extension=" + extensionLocation);

    options.merge(desiredCapabilities);
    WebDriver driver = new EdgeDriver(options);
    return driver;
    }

Resources