0

I am using Selenium's InternetExplorerDriver to run Edge in IE Compatibility Mode. What I would like to do is have Edge open "InPrivate".

When targeting IE itself, we can set the InternetExplorerOptions.BrowserCommandLineArguments = "-private" to get a private window. How do we do this when targeting Edge in IE Compatibility Mode with the InternetExplorerDriver?

Thanks

James
  • 1,979
  • 5
  • 24
  • 52
  • I tested this arguments in Edge IE mode, but it not working. It only works in IE automation with Selenium. And there is no related official doc for reference, so I'm afraid this requirement cannot be achieved. – Xudong Peng Jun 17 '22 at 10:19
  • @James can you please share the code for opening Edge in IE Mode. Am looking for solution. raise a question here . https://stackoverflow.com/questions/76383457/org-openqa-selenium-sessionnotcreatedexception-while-triggering-the-edge-browser – Selenium Lover Jun 01 '23 at 18:07

1 Answers1

0

You can try like the below

InternetExplorerDriverService ieService = InternetExplorerDriverService.createDefaultService();

    DesiredCapabilities caps = new DesiredCapabilities();
    caps.setAcceptInsecureCerts(false);
    caps.setBrowserName("internet explorer");
    caps.setCapability("ie.edgechromium", true);
    System.out.println("caps.getBrowserName() = " + caps.getBrowserName());
    System.out.println("caps browserName = " + caps.getCapability("browserName"));
    caps.setCapability("ie.edgepath", "C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe");

    InternetExplorerOptions options = new InternetExplorerOptions();
    options.enablePersistentHovering();
    options.ignoreZoomSettings();
    options.requireWindowFocus();
    options.setCapability("ignoreProtectedModeSettings", true);
    WebDriver driver = new InternetExplorerDriver(ieService, options.merge(caps));
    driver.manage().window().maximize();
    driver.get("https://github.com");

if this launch the Internet Explorer, then one of the prerequisites is to enable IE11.

Just refer to this doc: Edge IE mode-Prerequisites.

And as far as I know, IEdriver will start any version of IE installed in the machine, when Edge IE mode conditions are not met, it will not launch Edge, but default Internet Explorer.

So you could upgrade the version of IE to 11. I think this should make it work.

Akzy
  • 1,817
  • 1
  • 7
  • 19