Search code examples
c++seleniumselenium-webdrivermicrosoft-edgeselenium-iedriver

I want to handle multiple windows in Edge-ie mode from Selenium


I'm running Edge-ie mode on Selenium

The usage version is as follows

Selenium: 3.141 (java)

IEdriver: 3.150.1

So far, I started Edge-ie mode and was able to operate the first screen However, when I open another screen, I cannot get the window handle, Cannot operate

It is commented that this is because IE driver is not supported (Browser.cpp line number 116 to 121)

if (this-> is_edge_chromium_) {
    LOG (TRACE) << "Entering Browser :: NewWindow3 but early exiting due to edge mode";
    // In Edge Chromium, we do not yet support attaching to new windows.
    // Quit early and ignore that event.
    return;
  }

I think I need to modify the ieDriver to interact with another screen in Edge-ie mode And now I think it is necessary to open Edge-ie mode instead of ie in the following places (BrowserFactory.cpp line number 793 to 805)

  if (is_protected_mode) {
    hr = :: CoCreateInstance (CLSID_InternetExplorer,
                            NULL,
                            context,
                            IID_IWebBrowser2,
                            reinterpret_cast <void **> (& browser));
  } else {
    hr = :: CoCreateInstance (CLSID_InternetExplorerMedium,
                            NULL,
                            context,
                            IID_IWebBrowser2,
                            reinterpret_cast <void **> (& browser));
  }

How can I start Edge-ie mode at the above location? Is there any other way to fix the IE driver? (By Google Translate)


Solution

  • Edge IE mode should be driven by IE driver. The situation you mentioned is related to this issue on GitHub. The official hasn't fixed it yet so there's no way to handle multiple windows in Edge IE mode from Selenium. I suggest that you can provide feedback about this issue to related product team.