Execute test in Internet Explorer (IE) mode in Microsoft Edge
As the Internet Explorer desktop application is determined to go out of support on June 15, 2022, Microsoft introduces IE mode in Microsoft Edge for organizations that still need Internet Explorer 11 for backward compatibility for legacy websites or apps. To learn more about IE mode, refer to this Microsoft document: What is Internet Explorer (IE) mode?
This tutorial shows you how to use Katalon Studio to run test cases in IE mode in Microsoft Edge.
In our example, we use a custom keyword called openIEModeEdgeBrowser
to open Microsoft Edge in IE mode. To learn more about custom keywords in Katalon Studio, refer to this document: Introduction to Custom Keywords.
You can find the sample project with the custom keyword in this GitHub repository: Open IE Mode in Edge Chromium.
- You can execute tests in Internet Explorer (IE) mode in Microsoft Edge, but you cannot record new tests in IE mode in Microsoft Edge.
Configure Internet Options settings
-
On Windows 10, follow the steps in this guide: Internet Explorer Configurations.
-
On Windows 11, follow these steps:
-
Open Control Panel and go to Network and Internet > Internet Options.
-
In the Internet Properties dialog, select the Security tab and choose Local intranet.
-
Click on the Sites button and enable Automatically detect intranet network.
-
Click OK.
-
Create the openIEModeEdgeBrowser custom keyword
-
Go to Tests Explorer > Keywords, and create a new keyword package.
Here we name the package
com.example
.
-
Right-click on the newly created package and create a new keyword class.
We name the class
openIEModeEdgeBrowser
.
In the
openIEModeEdgeBrowser.groovy
file, copy and paste the following script and save it.package com.example
import static com.kms.katalon.core.checkpoint.CheckpointFactory.findCheckpoint
import static com.kms.katalon.core.testcase.TestCaseFactory.findTestCase
import static com.kms.katalon.core.testdata.TestDataFactory.findTestData
import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
import com.kms.katalon.core.annotation.Keyword
import com.kms.katalon.core.checkpoint.Checkpoint
import com.kms.katalon.core.checkpoint.CheckpointFactory
import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords
import com.kms.katalon.core.model.FailureHandling
import com.kms.katalon.core.testcase.TestCase
import com.kms.katalon.core.testcase.TestCaseFactory
import com.kms.katalon.core.testdata.TestData
import com.kms.katalon.core.testdata.TestDataFactory
import com.kms.katalon.core.testobject.ObjectRepository
import com.kms.katalon.core.testobject.TestObject
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords
import internal.GlobalVariable
import org.openqa.selenium.WebElement
import org.openqa.selenium.ie.InternetExplorerDriver
import org.openqa.selenium.ie.InternetExplorerOptions
import org.openqa.selenium.WebDriver
import org.openqa.selenium.By
import com.kms.katalon.core.mobile.keyword.internal.MobileDriverFactory
import com.kms.katalon.core.webui.driver.DriverFactory
import com.kms.katalon.core.testobject.RequestObject
import com.kms.katalon.core.testobject.ResponseObject
import com.kms.katalon.core.testobject.ConditionType
import com.kms.katalon.core.testobject.TestObjectProperty
import com.kms.katalon.core.mobile.helper.MobileElementCommonHelper
import com.kms.katalon.core.util.KeywordUtil
import com.kms.katalon.core.webui.exception.WebElementNotFoundException
class openIEModeEdgeBrowser {
/**
* Open browser
*/
@Keyword
def openBrowser(String url) {
System.setProperty("webdriver.ie.driver", DriverFactory.getIEDriverPath());
InternetExplorerOptions edgeIe11Options = new InternetExplorerOptions();
Map<String, Object> ops = (Map<String, Object>) edgeIe11Options.getCapability("se:ieOptions");
ops.put("ie.edgechromium", true);
ops.put("ie.edgepath", "C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe");
edgeIe11Options.setCapability("ignoreProtectedModeSettings", true);
edgeIe11Options.setCapability("ignoreZoomSetting", true);
WebDriver driver = new InternetExplorerDriver(edgeIe11Options);
driver.get(url)
DriverFactory.changeWebDriver(driver)
}
}
Use the custom keyword to execute test cases in IE mode
In Katalon Studio, create a test case.
Modify the test case. Open the test case and use the custom keyword as the first test step to open Microsoft Edge in IE mode.
For example, we use the custom keyword at the beginning of the test case.
In Manual view:
In Script view:
// Use the custom keyword and URL defined as global variable to open the site in Edge, with IE mode
CustomKeywords.'com.example.openIEModeEdgeBrowser.openBrowser'(GlobalVariable.G_SiteURL)Save your test case, then select the IE option to run the test.
Katalon Studio should open a Microsoft Edge browser session in IE mode.
Verify the results in Log Viewer.