IE mode on Edge browser
Some (older) websites are built to run on Internet Explorer and might have features that are not supported by current browsers, such as Microsoft Edge. Microsoft Edge is the successor of Internet Explorer.
Microsoft Edge provides an Internet Explorer Mode with Microsoft Edge, which allows you to run the Edge browser just like you would be running an IE 11 browser.
IE mode on Microsoft Edge is supported from Selenium version 4 and higher.
Start using Internet Explorer Mode
To run your Selenium 4 tests with IE Mode and Edge, you can use the ie.edgechromium capability with se:ieOptions. Please see the example below.
Copy
InternetExplorerOptions options = new InternetExplorerOptions();
options.attachToEdgeChrome();
HashMap<String, Object> tbOptions = new HashMap<>();
tbOptions.put("key", "API_KEY");
tbOptions.put("secret", "API_SECRET");
options.setCapability("tb:options", tbOptions);
WebDriver driver = new RemoteWebDriver(new URL("https://hub.testingbot.com/wd/hub"), options);
Copy
from selenium import webdriver
from selenium.webdriver.ie.options import Options
options = Options()
options.attach_to_edge_chrome = True
options.set_capability('tb:options', {
'key': 'API_KEY',
'secret': 'API_SECRET'
})
driver = webdriver.Remote(
command_executor='https://hub.testingbot.com/wd/hub',
options=options
)
Copy
const { Builder } = require('selenium-webdriver');
const ie = require('selenium-webdriver/ie');
async function runTest() {
let options = new ie.Options();
options.setEdgeChromium(true);
options.set('tb:options', {
'key': 'API_KEY',
'secret': 'API_SECRET'
});
let driver = await new Builder()
.usingServer('https://hub.testingbot.com/wd/hub')
.setIeOptions(options)
.build();
}
runTest();
Copy
options = Selenium::WebDriver::IE::Options.new
options.attach_to_edge_chrome = true
options.add_option('tb:options', {
'key' => 'API_KEY',
'secret' => 'API_SECRET'
})
driver = Selenium::WebDriver.for(:remote,
url: 'https://hub.testingbot.com/wd/hub',
options: options
)
Copy
$capabilities = DesiredCapabilities::internetExplorer();
$capabilities->setCapability('platformName', 'WIN11');
$capabilities->setCapability('se:ieOptions', [
'ie.edgechromium' => true
]);
$capabilities->setCapability('tb:options', [
'key' => 'API_KEY',
'secret' => 'API_SECRET'
]);
$driver = RemoteWebDriver::create(
'https://hub.testingbot.com/wd/hub',
$capabilities
);
Copy
var options = new InternetExplorerOptions();
options.AttachToEdgeChrome = true;
options.PlatformName = "WIN11";
options.AddAdditionalOption("tb:options", new Dictionary<string, object>
{
["key"] = "API_KEY",
["secret"] = "API_SECRET"
});
IWebDriver driver = new RemoteWebDriver(
new Uri("https://hub.testingbot.com/wd/hub"),
options
);