Use Internet Explorer mode in Edge in Selenium tests

To test websites that rely on legacy Internet Explorer features, you can enable Internet Explorer mode in Microsoft Edge. This allows you to run Selenium tests on such sites without switching browsers.

Prerequisites

  • Selenium 4 or later
  • Perfecto cloud access
  • Microsoft Edge browser on a Windows machine

Steps

  1. In your Selenium script, specify Edge as the browser name.

  2. Add the ie-mode capability to your script, either directly with the perfecto: prefix or as a nested capability inside a HashMap, passed to the perfecto:options capability, as shown in the following code snippet.

    Copy
    Example: Direct capability
    capabilities.setCapability("browserName", "Edge");
    capabilities.setCapability("perfecto:ie-mode", true);
    Copy
    Example: Nested capability
    HashMap<String, Object> options = new HashMap<>();
    options.put("ie-mode", true);

    capabilities.setCapability("perfecto:options", options);