These are capabilities and features specific to Microsoft Internet Explorer browsers.
As of June 2022, Selenium officially no longer supports standalone Internet Explorer.
The Internet Explorer driver still supports running Microsoft Edge in “IE Compatibility Mode.”
Special considerations
The IE Driver is the only driver maintained by the Selenium Project directly.
While binaries for both the 32-bit and 64-bit
versions of Internet Explorer are available, there are some
known limitations
with the 64-bit driver. As such it is recommended to use the 32-bit driver.
Additional information about using Internet Explorer can be found on the
IE Driver Server page
Options
Starting a Microsoft Edge browser in Internet Explorer Compatibility mode with basic defined options looks like this:
If IE is not present on the system (default in Windows 11), you do not need to
use the two parameters above. IE Driver will use Edge and will automatically locate it.
If IE and Edge are both present on the system, you only need to set attaching to Edge,
IE Driver will automatically locate Edge on your system.
Here are a few common use cases with different capabilities:
fileUploadDialogTimeout
In some environments, Internet Explorer may timeout when opening the
File Upload dialog. IEDriver has a default timeout of 1000ms, but you
can increase the timeout using the fileUploadDialogTimeout capability.
When set to true, this capability clears the Cache,
Browser History and Cookies for all running instances
of InternetExplorer including those started manually
or by the driver. By default, it is set to false.
Using this capability will cause performance drop while
launching the browser, as the driver will wait until the cache
gets cleared before launching the IE browser.
This capability accepts a Boolean value as parameter.
InternetExplorer driver expects the browser zoom level to be 100%,
else the driver will throw an exception. This default behaviour
can be disabled by setting the ignoreZoomSetting to true.
This capability accepts a Boolean value as parameter.
Whether to skip the Protected Mode check while launching
a new IE session.
If not set and Protected Mode settings are not same for
all zones, an exception will be thrown by the driver.
If capability is set to true, tests may
become flaky, unresponsive, or browsers may hang.
However, this is still by far a second-best choice,
and the first choice should always be to actually
set the Protected Mode settings of each zone manually.
If a user is using this property,
only a “best effort” at support will be given.
This capability accepts a Boolean value as parameter.
Internet Explorer includes several command-line options
that enable you to troubleshoot and configure the browser.
The following describes few supported command-line options
-private : Used to start IE in private browsing mode. This works for IE 8 and later versions.
-k : Starts Internet Explorer in kiosk mode.
The browser opens in a maximized window that does not display the address bar, the navigation buttons, or the status bar.
-extoff : Starts IE in no add-on mode.
This option specifically used to troubleshoot problems with browser add-ons. Works in IE 7 and later versions.
Note: forceCreateProcessApi should to enabled in-order for command line arguments to work.
Service settings common to all browsers are described on the Service page.
Log output
Getting driver logs can be helpful for debugging various issues. The Service class lets you
direct where the logs will go. Logging output is ignored unless the user directs it somewhere.
File output
To change the logging output to save to a specific file:
importosimportsubprocessimportsysimportpytestfromseleniumimportwebdriverEDGE_BINARY=os.getenv("EDGE_BINARY")@pytest.mark.skipif(sys.platform!="win32",reason="requires Windows")deftest_basic_options_win10():options=webdriver.IeOptions()options.attach_to_edge_chrome=Trueoptions.edge_executable_path=EDGE_BINARYdriver=webdriver.Ie(options=options)driver.quit()@pytest.mark.skipif(sys.platform!="win32",reason="requires Windows")deftest_basic_options_win11():options=webdriver.IeOptions()driver=webdriver.Ie(options=options)driver.quit()@pytest.mark.skipif(sys.platform!="win32",reason="requires Windows")deftest_log_to_file(log_path):service=webdriver.ie.service.Service(log_file=log_path,log_level='INFO')driver=webdriver.Ie(service=service)withopen(log_path,'r')asfp:assert"Starting WebDriver server"infp.readline()driver.quit()@pytest.mark.skip(reason="this is not supported, yet")deftest_log_to_stdout(capfd):service=webdriver.ie.service.Service(log_output=subprocess.STDOUT)driver=webdriver.Ie(service=service)out,err=capfd.readouterr()assert"Started InternetExplorerDriver server"inoutdriver.quit()@pytest.mark.skipif(sys.platform!="win32",reason="requires Windows")deftest_log_level(log_path):service=webdriver.ie.service.Service(log_file=log_path,log_level='WARN')driver=webdriver.Ie(service=service)withopen(log_path,'r')asfp:assert'Invalid capability setting: timeouts is type null'infp.readline()driver.quit()@pytest.mark.skipif(sys.platform!="win32",reason="requires Windows")deftest_supporting_files(temp_dir):service=webdriver.ie.service.Service(service_args=["–extract-path="+temp_dir])driver=webdriver.Ie(service=service)driver.quit()
packagedev.selenium.browsers;importorg.junit.jupiter.api.AfterEach;importorg.junit.jupiter.api.Assertions;importorg.junit.jupiter.api.Test;importorg.junit.jupiter.api.condition.EnabledOnOs;importorg.junit.jupiter.api.condition.OS;importorg.openqa.selenium.ie.InternetExplorerDriver;importorg.openqa.selenium.ie.InternetExplorerDriverLogLevel;importorg.openqa.selenium.ie.InternetExplorerDriverService;importorg.openqa.selenium.ie.InternetExplorerOptions;importjava.io.File;importjava.io.IOException;importjava.io.PrintStream;importjava.nio.file.Files;@EnabledOnOs(OS.WINDOWS)publicclassInternetExplorerTest{publicInternetExplorerDriverdriver;privateFilelogLocation;privateFiletempDirectory;@AfterEachpublicvoidquit(){if(logLocation!=null&&logLocation.exists()){logLocation.delete();}if(tempDirectory!=null&&tempDirectory.exists()){tempDirectory.delete();}driver.quit();}@TestpublicvoidbasicOptionsWin10(){InternetExplorerOptionsoptions=newInternetExplorerOptions();options.attachToEdgeChrome();options.withEdgeExecutablePath(System.getProperty("webdriver.edge.binary"));driver=newInternetExplorerDriver(options);}@TestpublicvoidbasicOptionsWin11(){InternetExplorerOptionsoptions=newInternetExplorerOptions();driver=newInternetExplorerDriver(options);}@TestpublicvoidlogsToFile()throwsIOException{InternetExplorerDriverServiceservice=newInternetExplorerDriverService.Builder().withLogFile(getLogLocation()).build();driver=newInternetExplorerDriver(service);StringfileContent=newString(Files.readAllBytes(getLogLocation().toPath()));Assertions.assertTrue(fileContent.contains("Started InternetExplorerDriver server"));}@TestpublicvoidlogsToConsole()throwsIOException{System.setOut(newPrintStream(getLogLocation()));InternetExplorerDriverServiceservice=newInternetExplorerDriverService.Builder().withLogOutput(System.out).build();driver=newInternetExplorerDriver(service);StringfileContent=newString(Files.readAllBytes(getLogLocation().toPath()));Assertions.assertTrue(fileContent.contains("Started InternetExplorerDriver server"));}@TestpublicvoidlogsWithLevel()throwsIOException{System.setProperty(InternetExplorerDriverService.IE_DRIVER_LOGFILE_PROPERTY,getLogLocation().getAbsolutePath());InternetExplorerDriverServiceservice=newInternetExplorerDriverService.Builder().withLogLevel(InternetExplorerDriverLogLevel.WARN).build();driver=newInternetExplorerDriver(service);StringfileContent=newString(Files.readAllBytes(getLogLocation().toPath()));Assertions.assertTrue(fileContent.contains("Invalid capability setting: timeouts is type null"));}@TestpublicvoidsupportingFilesLocation()throwsIOException{InternetExplorerDriverServiceservice=newInternetExplorerDriverService.Builder().withExtractPath(getTempDirectory()).build();driver=newInternetExplorerDriver(service);Assertions.assertTrue(newFile(getTempDirectory()+"/IEDriver.tmp").exists());}privateFilegetLogLocation()throwsIOException{if(logLocation==null||!logLocation.exists()){logLocation=File.createTempFile("iedriver-",".log");}returnlogLocation;}privateFilegetTempDirectory()throwsIOException{if(tempDirectory==null||!tempDirectory.exists()){tempDirectory=Files.createTempDirectory("supporting-").toFile();}returntempDirectory;}}
Note: Java also allows setting console output by System Property; Property key: InternetExplorerDriverService.IE_DRIVER_LOGFILE_PROPERTY Property value: DriverService.LOG_STDOUT or DriverService.LOG_STDERR
importosimportsubprocessimportsysimportpytestfromseleniumimportwebdriverEDGE_BINARY=os.getenv("EDGE_BINARY")@pytest.mark.skipif(sys.platform!="win32",reason="requires Windows")deftest_basic_options_win10():options=webdriver.IeOptions()options.attach_to_edge_chrome=Trueoptions.edge_executable_path=EDGE_BINARYdriver=webdriver.Ie(options=options)driver.quit()@pytest.mark.skipif(sys.platform!="win32",reason="requires Windows")deftest_basic_options_win11():options=webdriver.IeOptions()driver=webdriver.Ie(options=options)driver.quit()@pytest.mark.skipif(sys.platform!="win32",reason="requires Windows")deftest_log_to_file(log_path):service=webdriver.ie.service.Service(log_file=log_path,log_level='INFO')driver=webdriver.Ie(service=service)withopen(log_path,'r')asfp:assert"Starting WebDriver server"infp.readline()driver.quit()@pytest.mark.skip(reason="this is not supported, yet")deftest_log_to_stdout(capfd):service=webdriver.ie.service.Service(log_output=subprocess.STDOUT)driver=webdriver.Ie(service=service)out,err=capfd.readouterr()assert"Started InternetExplorerDriver server"inoutdriver.quit()@pytest.mark.skipif(sys.platform!="win32",reason="requires Windows")deftest_log_level(log_path):service=webdriver.ie.service.Service(log_file=log_path,log_level='WARN')driver=webdriver.Ie(service=service)withopen(log_path,'r')asfp:assert'Invalid capability setting: timeouts is type null'infp.readline()driver.quit()@pytest.mark.skipif(sys.platform!="win32",reason="requires Windows")deftest_supporting_files(temp_dir):service=webdriver.ie.service.Service(service_args=["–extract-path="+temp_dir])driver=webdriver.Ie(service=service)driver.quit()
packagedev.selenium.browsers;importorg.junit.jupiter.api.AfterEach;importorg.junit.jupiter.api.Assertions;importorg.junit.jupiter.api.Test;importorg.junit.jupiter.api.condition.EnabledOnOs;importorg.junit.jupiter.api.condition.OS;importorg.openqa.selenium.ie.InternetExplorerDriver;importorg.openqa.selenium.ie.InternetExplorerDriverLogLevel;importorg.openqa.selenium.ie.InternetExplorerDriverService;importorg.openqa.selenium.ie.InternetExplorerOptions;importjava.io.File;importjava.io.IOException;importjava.io.PrintStream;importjava.nio.file.Files;@EnabledOnOs(OS.WINDOWS)publicclassInternetExplorerTest{publicInternetExplorerDriverdriver;privateFilelogLocation;privateFiletempDirectory;@AfterEachpublicvoidquit(){if(logLocation!=null&&logLocation.exists()){logLocation.delete();}if(tempDirectory!=null&&tempDirectory.exists()){tempDirectory.delete();}driver.quit();}@TestpublicvoidbasicOptionsWin10(){InternetExplorerOptionsoptions=newInternetExplorerOptions();options.attachToEdgeChrome();options.withEdgeExecutablePath(System.getProperty("webdriver.edge.binary"));driver=newInternetExplorerDriver(options);}@TestpublicvoidbasicOptionsWin11(){InternetExplorerOptionsoptions=newInternetExplorerOptions();driver=newInternetExplorerDriver(options);}@TestpublicvoidlogsToFile()throwsIOException{InternetExplorerDriverServiceservice=newInternetExplorerDriverService.Builder().withLogFile(getLogLocation()).build();driver=newInternetExplorerDriver(service);StringfileContent=newString(Files.readAllBytes(getLogLocation().toPath()));Assertions.assertTrue(fileContent.contains("Started InternetExplorerDriver server"));}@TestpublicvoidlogsToConsole()throwsIOException{System.setOut(newPrintStream(getLogLocation()));InternetExplorerDriverServiceservice=newInternetExplorerDriverService.Builder().withLogOutput(System.out).build();driver=newInternetExplorerDriver(service);StringfileContent=newString(Files.readAllBytes(getLogLocation().toPath()));Assertions.assertTrue(fileContent.contains("Started InternetExplorerDriver server"));}@TestpublicvoidlogsWithLevel()throwsIOException{System.setProperty(InternetExplorerDriverService.IE_DRIVER_LOGFILE_PROPERTY,getLogLocation().getAbsolutePath());InternetExplorerDriverServiceservice=newInternetExplorerDriverService.Builder().withLogLevel(InternetExplorerDriverLogLevel.WARN).build();driver=newInternetExplorerDriver(service);StringfileContent=newString(Files.readAllBytes(getLogLocation().toPath()));Assertions.assertTrue(fileContent.contains("Invalid capability setting: timeouts is type null"));}@TestpublicvoidsupportingFilesLocation()throwsIOException{InternetExplorerDriverServiceservice=newInternetExplorerDriverService.Builder().withExtractPath(getTempDirectory()).build();driver=newInternetExplorerDriver(service);Assertions.assertTrue(newFile(getTempDirectory()+"/IEDriver.tmp").exists());}privateFilegetLogLocation()throwsIOException{if(logLocation==null||!logLocation.exists()){logLocation=File.createTempFile("iedriver-",".log");}returnlogLocation;}privateFilegetTempDirectory()throwsIOException{if(tempDirectory==null||!tempDirectory.exists()){tempDirectory=Files.createTempDirectory("supporting-").toFile();}returntempDirectory;}}
Note: Java also allows setting log level by System Property: Property key: InternetExplorerDriverService.IE_DRIVER_LOGLEVEL_PROPERTY Property value: String representation of InternetExplorerDriverLogLevel.DEBUG.toString() enum
importosimportsubprocessimportsysimportpytestfromseleniumimportwebdriverEDGE_BINARY=os.getenv("EDGE_BINARY")@pytest.mark.skipif(sys.platform!="win32",reason="requires Windows")deftest_basic_options_win10():options=webdriver.IeOptions()options.attach_to_edge_chrome=Trueoptions.edge_executable_path=EDGE_BINARYdriver=webdriver.Ie(options=options)driver.quit()@pytest.mark.skipif(sys.platform!="win32",reason="requires Windows")deftest_basic_options_win11():options=webdriver.IeOptions()driver=webdriver.Ie(options=options)driver.quit()@pytest.mark.skipif(sys.platform!="win32",reason="requires Windows")deftest_log_to_file(log_path):service=webdriver.ie.service.Service(log_file=log_path,log_level='INFO')driver=webdriver.Ie(service=service)withopen(log_path,'r')asfp:assert"Starting WebDriver server"infp.readline()driver.quit()@pytest.mark.skip(reason="this is not supported, yet")deftest_log_to_stdout(capfd):service=webdriver.ie.service.Service(log_output=subprocess.STDOUT)driver=webdriver.Ie(service=service)out,err=capfd.readouterr()assert"Started InternetExplorerDriver server"inoutdriver.quit()@pytest.mark.skipif(sys.platform!="win32",reason="requires Windows")deftest_log_level(log_path):service=webdriver.ie.service.Service(log_file=log_path,log_level='WARN')driver=webdriver.Ie(service=service)withopen(log_path,'r')asfp:assert'Invalid capability setting: timeouts is type null'infp.readline()driver.quit()@pytest.mark.skipif(sys.platform!="win32",reason="requires Windows")deftest_supporting_files(temp_dir):service=webdriver.ie.service.Service(service_args=["–extract-path="+temp_dir])driver=webdriver.Ie(service=service)driver.quit()
usingSystem;usingSystem.IO;usingSystem.Linq;usingMicrosoft.VisualStudio.TestTools.UnitTesting;usingOpenQA.Selenium.IE;usingSeleniumDocs.TestSupport;namespaceSeleniumDocs.Browsers{ [TestClassCustom] [EnabledOnOs("WINDOWS")]publicclassInternetExplorerTest{privateInternetExplorerDriverdriver;privatestring_logLocation;privatestring_tempPath; [TestCleanup]publicvoidCleanup(){if(_logLocation!=null&&File.Exists(_logLocation)){File.Delete(_logLocation);}if(_tempPath!=null&&File.Exists(_tempPath)){File.Delete(_tempPath);}driver.Quit();} [TestMethod]publicvoidBasicOptionsWin10(){varoptions=newInternetExplorerOptions();options.AttachToEdgeChrome=true;options.EdgeExecutablePath=Environment.GetEnvironmentVariable("EDGE_BINARY");driver=newInternetExplorerDriver(options);} [TestMethod]publicvoidBasicOptionsWin11(){varoptions=newInternetExplorerOptions();driver=newInternetExplorerDriver(options);} [TestMethod] [Ignore("Not implemented")]publicvoidLogsToFile(){varservice=InternetExplorerDriverService.CreateDefaultService();service.LogFile=GetLogLocation();driver=newInternetExplorerDriver(service);driver.Quit();// Close the Service log file before readingvarlines=File.ReadLines(GetLogLocation());Assert.IsNotNull(lines.FirstOrDefault(line=>line.Contains("geckodriver INFO Listening on")));} [TestMethod] [Ignore("Not implemented")]publicvoidLogsToConsole(){varstringWriter=newStringWriter();varoriginalOutput=Console.Out;Console.SetOut(stringWriter);varservice=InternetExplorerDriverService.CreateDefaultService();//service.LogToConsole = true;driver=newInternetExplorerDriver(service);Assert.IsTrue(stringWriter.ToString().Contains("geckodriver INFO Listening on"));Console.SetOut(originalOutput);stringWriter.Dispose();} [TestMethod]publicvoidLogsLevel(){varservice=InternetExplorerDriverService.CreateDefaultService();service.LogFile=GetLogLocation();service.LoggingLevel=InternetExplorerDriverLogLevel.Warn;driver=newInternetExplorerDriver(service);driver.Quit();// Close the Service log file before readingvarlines=File.ReadLines(GetLogLocation());Assert.IsNotNull(lines.FirstOrDefault(line=>line.Contains("Invalid capability setting: timeouts is type null")));} [TestMethod]publicvoidSupportingFilesLocation(){varservice=InternetExplorerDriverService.CreateDefaultService();service.LibraryExtractionPath=GetTempDirectory();driver=newInternetExplorerDriver(service);Assert.IsTrue(File.Exists(GetTempDirectory()+"/IEDriver.tmp"));}privatestringGetLogLocation(){if(_logLocation==null||!File.Exists(_logLocation)){_logLocation=Path.GetTempFileName();}return_logLocation;}privatestringGetTempDirectory(){if(_tempPath==null||!File.Exists(_tempPath)){_tempPath=Path.GetTempPath();}return_tempPath;}}}
importosimportsubprocessimportsysimportpytestfromseleniumimportwebdriverEDGE_BINARY=os.getenv("EDGE_BINARY")@pytest.mark.skipif(sys.platform!="win32",reason="requires Windows")deftest_basic_options_win10():options=webdriver.IeOptions()options.attach_to_edge_chrome=Trueoptions.edge_executable_path=EDGE_BINARYdriver=webdriver.Ie(options=options)driver.quit()@pytest.mark.skipif(sys.platform!="win32",reason="requires Windows")deftest_basic_options_win11():options=webdriver.IeOptions()driver=webdriver.Ie(options=options)driver.quit()@pytest.mark.skipif(sys.platform!="win32",reason="requires Windows")deftest_log_to_file(log_path):service=webdriver.ie.service.Service(log_file=log_path,log_level='INFO')driver=webdriver.Ie(service=service)withopen(log_path,'r')asfp:assert"Starting WebDriver server"infp.readline()driver.quit()@pytest.mark.skip(reason="this is not supported, yet")deftest_log_to_stdout(capfd):service=webdriver.ie.service.Service(log_output=subprocess.STDOUT)driver=webdriver.Ie(service=service)out,err=capfd.readouterr()assert"Started InternetExplorerDriver server"inoutdriver.quit()@pytest.mark.skipif(sys.platform!="win32",reason="requires Windows")deftest_log_level(log_path):service=webdriver.ie.service.Service(log_file=log_path,log_level='WARN')driver=webdriver.Ie(service=service)withopen(log_path,'r')asfp:assert'Invalid capability setting: timeouts is type null'infp.readline()driver.quit()@pytest.mark.skipif(sys.platform!="win32",reason="requires Windows")deftest_supporting_files(temp_dir):service=webdriver.ie.service.Service(service_args=["–extract-path="+temp_dir])driver=webdriver.Ie(service=service)driver.quit()
usingSystem;usingSystem.IO;usingSystem.Linq;usingMicrosoft.VisualStudio.TestTools.UnitTesting;usingOpenQA.Selenium.IE;usingSeleniumDocs.TestSupport;namespaceSeleniumDocs.Browsers{ [TestClassCustom] [EnabledOnOs("WINDOWS")]publicclassInternetExplorerTest{privateInternetExplorerDriverdriver;privatestring_logLocation;privatestring_tempPath; [TestCleanup]publicvoidCleanup(){if(_logLocation!=null&&File.Exists(_logLocation)){File.Delete(_logLocation);}if(_tempPath!=null&&File.Exists(_tempPath)){File.Delete(_tempPath);}driver.Quit();} [TestMethod]publicvoidBasicOptionsWin10(){varoptions=newInternetExplorerOptions();options.AttachToEdgeChrome=true;options.EdgeExecutablePath=Environment.GetEnvironmentVariable("EDGE_BINARY");driver=newInternetExplorerDriver(options);} [TestMethod]publicvoidBasicOptionsWin11(){varoptions=newInternetExplorerOptions();driver=newInternetExplorerDriver(options);} [TestMethod] [Ignore("Not implemented")]publicvoidLogsToFile(){varservice=InternetExplorerDriverService.CreateDefaultService();service.LogFile=GetLogLocation();driver=newInternetExplorerDriver(service);driver.Quit();// Close the Service log file before readingvarlines=File.ReadLines(GetLogLocation());Assert.IsNotNull(lines.FirstOrDefault(line=>line.Contains("geckodriver INFO Listening on")));} [TestMethod] [Ignore("Not implemented")]publicvoidLogsToConsole(){varstringWriter=newStringWriter();varoriginalOutput=Console.Out;Console.SetOut(stringWriter);varservice=InternetExplorerDriverService.CreateDefaultService();//service.LogToConsole = true;driver=newInternetExplorerDriver(service);Assert.IsTrue(stringWriter.ToString().Contains("geckodriver INFO Listening on"));Console.SetOut(originalOutput);stringWriter.Dispose();} [TestMethod]publicvoidLogsLevel(){varservice=InternetExplorerDriverService.CreateDefaultService();service.LogFile=GetLogLocation();service.LoggingLevel=InternetExplorerDriverLogLevel.Warn;driver=newInternetExplorerDriver(service);driver.Quit();// Close the Service log file before readingvarlines=File.ReadLines(GetLogLocation());Assert.IsNotNull(lines.FirstOrDefault(line=>line.Contains("Invalid capability setting: timeouts is type null")));} [TestMethod]publicvoidSupportingFilesLocation(){varservice=InternetExplorerDriverService.CreateDefaultService();service.LibraryExtractionPath=GetTempDirectory();driver=newInternetExplorerDriver(service);Assert.IsTrue(File.Exists(GetTempDirectory()+"/IEDriver.tmp"));}privatestringGetLogLocation(){if(_logLocation==null||!File.Exists(_logLocation)){_logLocation=Path.GetTempFileName();}return_logLocation;}privatestringGetTempDirectory(){if(_tempPath==null||!File.Exists(_tempPath)){_tempPath=Path.GetTempPath();}return_tempPath;}}}