Issues and Fixes
June 25, 2021

Running Microsoft Edge in Internet Explorer Mode

To configure Microsoft Edge Browser to open websites in IE mode follow these steps:

Step 1: Install Microsoft Edge policy template

a) Open - https://www.microsoft.com/en-us/edge/business/download.

b) Scroll down the page (till u see a download button). Select the Version, Build, Platform of your Microsoft Edge      installation.

c) Click on GET POLICY FILES. File MicrosoftEdgePolicyTemplates.cab gets downloaded. This file contains      MicrosoftEdgePolicyTemplates.zip. Extract the zip file contents to a folder.

d) Open windows\admx folder. Copy files msedge.admx and msedgeupdate.admx
     to C:\Windows\PolicyDefinitions folder.

e) Again open windows\admx folder. Open the language folder that represents your language — for example, en-US.     Copy files msedge.adml and msedgeupdate.adml to C:\Windows\PolicyDefinitions\en-US folder.

Step 2: Create an Enterprise Site XML list

a) Create a file with the name SiteList.xml in the <Sahi_Installation_Folder>\userdata folder.

b) Open the SiteList.xml file with a text editor and paste the below XML content.

<?xml version="1.0"?>
<site-list version="205">
   <site url="sahi.example.com">
       <compat-mode>default</compat-mode>
       <open-in>IE11</open-in>
   </site>
   <site url="sahipro.com">
       <compat-mode>default</compat-mode>
       <open-in>IE11</open-in>
   </site>
   <site url="sahitest.com">
       <compat-mode>default</compat-mode>
       <open-in>IE11</open-in>
   </site>
</site-list>

c) The url attribute for the first site xml node is specified as sahi.example.com . By default, sahi.common_domain property is set as sahi.example.com in userdata.properties. If any other domain is set as Sahi common domain, replace sahi.example.com with that domain in the XML content.

d) The url attribute for other site xml nodes is specified as sahitest.com and sahipro.com. Replace them with your application domains.

e) Save this SiteList.xml file.

Step 3: Enable IE Mode on Chromium Edge

a) Open Local Group Policy Editor. Navigate to Computer Configuration > Administrative Templates >
 Microsoft Edge
.

b)  Click on "configure Internet Explorer Integration" in "Settings" option as shown in the image below..

     (i) Select the Enabled option to enable IE Mode for Microsoft Edge.

     (ii) Click Apply. Click OK.

c) Click on "Configure the Enterprise Mode Site List" in "Settings" option of Microsoft Edge as shown in the image below

     (i) Select the Enabled option.

    (ii) In Step 2, we have created SiteList.xml file.

     (iii) Under the Options section, specify the path for this XML file containing a list of websites you want to render in       Internet Explorer mode.
            Example for a local XML file path: file:///C:/Users/user1/sahi_pro/userdata/SiteList.xml.

    ‍(iii) Click Apply. Click OK.

Step 4: Specify sites to open in IE mode

a) Create a folder with name as Default in <Sahi_Installation_Folder>\config\edge_profile_template folder.

b) Create a file with the name Preferences (without any extension) in this Default folder.

c) Open this Preferences file with a text editor and paste the below JSON content.

{"dual_engine":{"sitelist_data_1":{"*":{"sahi.example.com":{"/":{"engine":2}},"sahipro.com":{"/
":{"engine":2}},"sahitest.com":{"/":{"engine":2}}}}}}

d) By default, sahi.common_domain property is set as sahi.example.com in userdata.properties. If any other domain is set as Sahi common domain, replace sahi.example.com with that domain in the JSON content.

e) Note that sahitest.com and sahipro.com domains have been added to the JSON content. Replace them with your application domains.

f) Save the file.

Step 5: Ensure that profiles are recreated for Microsoft Edge

a) Exit from Sahi if it is running.

b) Delete the folder edge present in <Sahi_Installation_Folder>\userdata\browser folder.

Step 6: Modify browser_types.xml in Sahi

To automate in IE mode, we need to set Sahi as a system proxy. So we need to make the below changes in browser_types.xml.

a) Open <Sahi_Installation>/userdata/config/browser_types.xml file.

b) Search for msedge.exe. Remove --proxy-server=127.0.0.1:$port from startup options for Microsoft Edge.

c) Specify the value as true for <useSystemProxy> as shown in the example below.

    <browserType>
       <name>edgenew</name>
           <displayName>Edge New</displayName>
           <icon>msedge.png</icon>
            <path>$ProgramFiles(x86)\Microsoft\Edge\Application\msedge.exe</path>
            <options>--no-default-browser-check
  --user-data-dir=$userDir\browser\edge\profiles\sahi$threadNo
  --disable-popup-blocking -inprivate --disablebackground-networking
  --disable-component-update --disable-renderer-backgrounding
  --disable-backgrounding-occluded-windows
            </options>
            <processName>msedge.exe</processName>
            <useSystemProxy>true</useSystemProxy>
            <capacity>5</capacity>
  </browserType>

d) Save and restart Sahi.

Note:

  • Sahi common domain will now open in IE mode. So, Microsoft Edge will inhibit Sahi to automate other websites that are opened in Edge mode.
  • To automate in Edge mode, as a workaround modify the Sahi common domain. Set sahi.common_domain property to some other domain let’s say sahi.example1.com in userdata.properties. Restart Sahi.

References:

Continue reading