Funcionalidade específica do IE Estas capacidades e características são específicas ao navegador Microsoft Internet Explorer.
Desde Junho de 2022, o Projecto Selenium deixou de suportar oficialmente o navegador Internet Explorer.
O driver Internet Explorer continua a suportar a execução do Microsoft Edge no modo “IE Compatibility Mode.”
Considerações especiais O IE Driver é o único driver mantido directamente pelo Projecto Selenium.
Embora existam binários para as versões de 32 e 64 bits, existem algumas
limitações conhecidas
com o driver de 64 bits. Desta forma, recomenda-se a utilização do driver de 32 bits.
Informação adicional sobre como usar o Internet Explorer pode ser encontrada na
página IE Driver Server
Opções Este é um exemplo de como iniciar o navegador Microsoft Edge em modo compatibilidade Internet Explorer
usando um conjunto de opções básicas:
Java
Python
CSharp
Ruby
JavaScript
Kotlin /examples/java/src/test/java/dev/selenium/browsers/InternetExplorerTest.java
Copy
Close
package dev.selenium.browsers ;
import org.junit.jupiter.api.AfterEach ;
import org.junit.jupiter.api.Test ;
import org.junit.jupiter.api.condition.EnabledOnOs ;
import org.junit.jupiter.api.condition.OS ;
import org.openqa.selenium.ie.InternetExplorerDriver ;
import org.openqa.selenium.ie.InternetExplorerOptions ;
@EnabledOnOs ( OS . WINDOWS )
public class InternetExplorerTest {
public InternetExplorerDriver driver ;
@AfterEach
public void quit () {
driver . quit ();
}
@Test
public void basicOptions () {
InternetExplorerOptions options = new InternetExplorerOptions ();
driver = new InternetExplorerDriver ( options );
}
}
driver = webdriver . Ie ( options = options )
driver . quit ()
/examples/python/tests/browsers/test_internet_explorer.py
Copy
Close
import sys
import pytest
from selenium import webdriver
from selenium.webdriver.ie.options import Options as InternetExplorerOptions
@pytest.mark.skipif ( sys . platform != "win32" , reason = "requires Windows" )
def test_basic_options ():
options = InternetExplorerOptions ()
driver = webdriver . Ie ( options = options )
driver . quit ()
/examples/dotnet/SeleniumDocs/Browsers/InternetExplorerTest.cs
Copy
Close
using System ;
using System.IO ;
using Microsoft.VisualStudio.TestTools.UnitTesting ;
using OpenQA.Selenium.IE ;
using SeleniumDocs.TestSupport ;
namespace SeleniumDocs.Browsers
{
[TestClassCustom]
[EnabledOnOs("WINDOWS")]
public class InternetExplorerTest
{
[TestMethod]
public void BasicOptions ()
{
var options = new InternetExplorerOptions ();
var driver = new InternetExplorerDriver ( options );
driver . Quit ();
}
}
}
/examples/ruby/spec/browsers/internet_explorer_spec.rb
Copy
Close
# frozen_string_literal: true
require 'spec_helper'
RSpec . describe 'Internet Explorer' , exclusive : { platform : :windows } do
it 'basic options' do
options = Selenium :: WebDriver :: Options . ie
@driver = Selenium :: WebDriver . for :ie , options : options
end
end
A partir do driver versão v4.5.0:
Se o IE não estiver presente no sistema (ausente por omissão no Windows 11), não necessita
usar os parametros “attachToEdgeChrome” e “withEdgeExecutablePath”, pois o IE Driver
irá encontrar e usar o Edge automaticamente. Se o IE e o Edge estiverem ambos presentes no sistema, use o parametro “attachToEdgeChrome”,
o IE Driver irá encontrar e usar o Edge automaticamente. So, if IE is not on the system, you only need:
Java
Python
CSharp
Ruby
JavaScript
Kotlin /examples/java/src/test/java/dev/selenium/browsers/InternetExplorerTest.java
Copy
Close
package dev.selenium.browsers ;
import org.junit.jupiter.api.AfterEach ;
import org.junit.jupiter.api.Test ;
import org.junit.jupiter.api.condition.EnabledOnOs ;
import org.junit.jupiter.api.condition.OS ;
import org.openqa.selenium.ie.InternetExplorerDriver ;
import org.openqa.selenium.ie.InternetExplorerOptions ;
@EnabledOnOs ( OS . WINDOWS )
public class InternetExplorerTest {
public InternetExplorerDriver driver ;
@AfterEach
public void quit () {
driver . quit ();
}
@Test
public void basicOptions () {
InternetExplorerOptions options = new InternetExplorerOptions ();
driver = new InternetExplorerDriver ( options );
}
}
/examples/python/tests/browsers/test_internet_explorer.py
Copy
Close
import sys
import pytest
from selenium import webdriver
from selenium.webdriver.ie.options import Options as InternetExplorerOptions
@pytest.mark.skipif ( sys . platform != "win32" , reason = "requires Windows" )
def test_basic_options ():
options = InternetExplorerOptions ()
driver = webdriver . Ie ( options = options )
driver . quit ()
/examples/dotnet/SeleniumDocs/Browsers/InternetExplorerTest.cs
Copy
Close
using System ;
using System.IO ;
using Microsoft.VisualStudio.TestTools.UnitTesting ;
using OpenQA.Selenium.IE ;
using SeleniumDocs.TestSupport ;
namespace SeleniumDocs.Browsers
{
[TestClassCustom]
[EnabledOnOs("WINDOWS")]
public class InternetExplorerTest
{
[TestMethod]
public void BasicOptions ()
{
var options = new InternetExplorerOptions ();
var driver = new InternetExplorerDriver ( options );
driver . Quit ();
}
}
}
/examples/ruby/spec/browsers/internet_explorer_spec.rb
Copy
Close
# frozen_string_literal: true
require 'spec_helper'
RSpec . describe 'Internet Explorer' , exclusive : { platform : :windows } do
it 'basic options' do
options = Selenium :: WebDriver :: Options . ie
@driver = Selenium :: WebDriver . for :ie , options : options
end
end
let driver = await new Builder ()
. forBrowser ( 'internet explorer' )
. setIEOptions ( options )
. build ();
< p >< a href =/ documentation / about / contributing / # moving - examples >
< span class = "selenium-badge-code" data - bs - toggle = "tooltip" data - bs - placement = "right"
title = "One or more of these examples need to be implemented in the examples directory; click for details in the contribution guide" > Move Code </ span ></ a ></ p >
val options = InternetExplorerOptions ()
val driver = InternetExplorerDriver ( options )
Aqui pode ver alguns exemplos de utilização com capacidades diferentes:
fileUploadDialogTimeout Em alguns ambientes, o Internet Explorer pode expirar ao abrir a
Caixa de Diálogo de upload de arquivo. O IEDriver tem um tempo limite padrão de 1000 ms, mas você
pode aumentar o tempo limite usando o recurso fileUploadDialogTimeout.
Java
Python
CSharp
Ruby
JavaScript
Kotlin InternetExplorerOptions options = new InternetExplorerOptions ();
options . waitForUploadDialogUpTo ( Duration . ofSeconds ( 2 ));
WebDriver driver = new RemoteWebDriver ( options );
/examples/python/tests/browsers/test_internet_explorer.py
Copy
Close
import sys
import pytest
from selenium import webdriver
from selenium.webdriver.ie.options import Options as InternetExplorerOptions
@pytest.mark.skipif ( sys . platform != "win32" , reason = "requires Windows" )
def test_basic_options ():
options = InternetExplorerOptions ()
driver = webdriver . Ie ( options = options )
driver . quit ()
var options = new InternetExplorerOptions ();
options . FileUploadDialogTimeout = TimeSpan . FromMilliseconds ( 2000 );
var driver = new RemoteWebDriver ( options );
/examples/ruby/spec/browsers/internet_explorer_spec.rb
Copy
Close
# frozen_string_literal: true
require 'spec_helper'
RSpec . describe 'Internet Explorer' , exclusive : { platform : :windows } do
it 'basic options' do
options = Selenium :: WebDriver :: Options . ie
@driver = Selenium :: WebDriver . for :ie , options : options
end
end
const ie = require ( 'selenium-webdriver/ie' );
let options = new ie . Options (). fileUploadDialogTimeout ( 2000 );
let driver = await Builder ()
. setIeOptions ( options )
. build ();
val options = InternetExplorerOptions ()
options . waitForUploadDialogUpTo ( Duration . ofSeconds ( 2 ))
val driver = RemoteWebDriver ( options )
ensureCleanSession Quando definido como true
, este recurso limpa o Cache,
Histórico do navegador e cookies para todas as instâncias em execução
do InternetExplorer, incluindo aquelas iniciadas manualmente
ou pelo driver. Por padrão, é definido como false
.
Usar este recurso causará queda de desempenho quando
iniciar o navegador, pois o driver irá esperar até que o cache
seja limpo antes de iniciar o navegador IE.
Esse recurso aceita um valor booleano como parâmetro.
Java
Python
CSharp
Ruby
JavaScript
Kotlin InternetExplorerOptions options = new InternetExplorerOptions ();
options . destructivelyEnsureCleanSession ();
WebDriver driver = new RemoteWebDriver ( options );
/examples/python/tests/browsers/test_internet_explorer.py
Copy
Close
import sys
import pytest
from selenium import webdriver
from selenium.webdriver.ie.options import Options as InternetExplorerOptions
@pytest.mark.skipif ( sys . platform != "win32" , reason = "requires Windows" )
def test_basic_options ():
options = InternetExplorerOptions ()
driver = webdriver . Ie ( options = options )
driver . quit ()
var options = new InternetExplorerOptions ();
options . EnsureCleanSession = true ;
var driver = new RemoteWebDriver ( options );
/examples/ruby/spec/browsers/internet_explorer_spec.rb
Copy
Close
# frozen_string_literal: true
require 'spec_helper'
RSpec . describe 'Internet Explorer' , exclusive : { platform : :windows } do
it 'basic options' do
options = Selenium :: WebDriver :: Options . ie
@driver = Selenium :: WebDriver . for :ie , options : options
end
end
const ie = require ( 'selenium-webdriver/ie' );
let options = new ie . Options (). ensureCleanSession ( true );
let driver = await Builder ()
. setIeOptions ( options )
. build ();
val options = InternetExplorerOptions ()
options . destructivelyEnsureCleanSession ()
val driver = RemoteWebDriver ( options )
ignoreZoomSetting O driver do InternetExplorer espera que o nível de zoom do navegador seja de 100%,
caso contrário, o driver lançará uma exceção. Este comportamento padrão
pode ser desativado definindo ignoreZoomSetting como true .
Esse recurso aceita um valor booleano como parâmetro.
Java
Python
CSharp
Ruby
JavaScript
Kotlin InternetExplorerOptions options = new InternetExplorerOptions ();
options . ignoreZoomSettings ();
WebDriver driver = new RemoteWebDriver ( options );
/examples/python/tests/browsers/test_internet_explorer.py
Copy
Close
import sys
import pytest
from selenium import webdriver
from selenium.webdriver.ie.options import Options as InternetExplorerOptions
@pytest.mark.skipif ( sys . platform != "win32" , reason = "requires Windows" )
def test_basic_options ():
options = InternetExplorerOptions ()
driver = webdriver . Ie ( options = options )
driver . quit ()
var options = new InternetExplorerOptions ();
options . IgnoreZoomLevel = true ;
var driver = new RemoteWebDriver ( options );
/examples/ruby/spec/browsers/internet_explorer_spec.rb
Copy
Close
# frozen_string_literal: true
require 'spec_helper'
RSpec . describe 'Internet Explorer' , exclusive : { platform : :windows } do
it 'basic options' do
options = Selenium :: WebDriver :: Options . ie
@driver = Selenium :: WebDriver . for :ie , options : options
end
end
const ie = require ( 'selenium-webdriver/ie' );
let options = new ie . Options (). ignoreZoomSetting ( true );
let driver = await Builder ()
. setIeOptions ( options )
. build ();
val options = InternetExplorerOptions ()
options . ignoreZoomSettings ()
val driver = RemoteWebDriver ( options )
ignoreProtectedModeSettings Se deve ignorar a verificação do Modo protegido durante o lançamento
uma nova sessão do IE.
Se não for definido e as configurações do Modo protegido não forem iguais para
todas as zonas, uma exceção será lançada pelo driver.
Se a capacidade for definida como true
, os testes podem
tornar-se instáveis, não responderem ou os navegadores podem travar.
No entanto, esta ainda é de longe a segunda melhor escolha,
e a primeira escolha sempre deve ser
definir as configurações do Modo protegido de cada zona manualmente.
Se um usuário estiver usando esta propriedade,
apenas um “melhor esforço” no suporte será dado.
Esse recurso aceita um valor booleano como parâmetro.
Java
Python
CSharp
Ruby
JavaScript
Kotlin InternetExplorerOptions options = new InternetExplorerOptions ();
options . introduceFlakinessByIgnoringSecurityDomains ();
WebDriver driver = new RemoteWebDriver ( options );
/examples/python/tests/browsers/test_internet_explorer.py
Copy
Close
import sys
import pytest
from selenium import webdriver
from selenium.webdriver.ie.options import Options as InternetExplorerOptions
@pytest.mark.skipif ( sys . platform != "win32" , reason = "requires Windows" )
def test_basic_options ():
options = InternetExplorerOptions ()
driver = webdriver . Ie ( options = options )
driver . quit ()
var options = new InternetExplorerOptions ();
options . IntroduceInstabilityByIgnoringProtectedModeSettings = true ;
var driver = new RemoteWebDriver ( options );
/examples/ruby/spec/browsers/internet_explorer_spec.rb
Copy
Close
# frozen_string_literal: true
require 'spec_helper'
RSpec . describe 'Internet Explorer' , exclusive : { platform : :windows } do
it 'basic options' do
options = Selenium :: WebDriver :: Options . ie
@driver = Selenium :: WebDriver . for :ie , options : options
end
end
const ie = require ( 'selenium-webdriver/ie' );
let options = new ie . Options (). introduceFlakinessByIgnoringProtectedModeSettings ( true );
let driver = await Builder ()
. setIeOptions ( options )
. build ();
val options = InternetExplorerOptions ()
options . introduceFlakinessByIgnoringSecurityDomains ()
val driver = RemoteWebDriver ( options )
silent Quando definido como true
, esse recurso suprime a
saída de diagnóstico do IEDriverServer.
Esse recurso aceita um valor booleano como parâmetro.
Java
Python
CSharp
Ruby
JavaScript
Kotlin InternetExplorerOptions options = new InternetExplorerOptions ();
options . setCapability ( "silent" , true );
WebDriver driver = new InternetExplorerDriver ( options );
/examples/python/tests/browsers/test_internet_explorer.py
Copy
Close
import sys
import pytest
from selenium import webdriver
from selenium.webdriver.ie.options import Options as InternetExplorerOptions
@pytest.mark.skipif ( sys . platform != "win32" , reason = "requires Windows" )
def test_basic_options ():
options = InternetExplorerOptions ()
driver = webdriver . Ie ( options = options )
driver . quit ()
InternetExplorerOptions options = new InternetExplorerOptions ();
options . AddAdditionalInternetExplorerOption ( "silent" , true );
IWebDriver driver = new InternetExplorerDriver ( options );
/examples/ruby/spec/browsers/internet_explorer_spec.rb
Copy
Close
# frozen_string_literal: true
require 'spec_helper'
RSpec . describe 'Internet Explorer' , exclusive : { platform : :windows } do
it 'basic options' do
options = Selenium :: WebDriver :: Options . ie
@driver = Selenium :: WebDriver . for :ie , options : options
end
end
const { Builder , By , Capabilities } = require ( 'selenium-webdriver' );
let caps = Capabilities . ie ();
caps . set ( 'silent' , true );
( async function example () {
let driver = await new Builder ()
. forBrowser ( 'internet explorer' )
. withCapabilities ( caps )
. build ();
try {
await driver . get ( 'http://www.google.com/ncr' );
}
finally {
await driver . quit ();
}
})();
import org.openqa.selenium.Capabilities
import org.openqa.selenium.ie.InternetExplorerDriver
import org.openqa.selenium.ie.InternetExplorerOptions
fun main () {
val options = InternetExplorerOptions ()
options . setCapability ( "silent" , true )
val driver = InternetExplorerDriver ( options )
try {
driver . get ( "https://google.com/ncr" )
val caps = driver . getCapabilities ()
println ( caps )
} finally {
driver . quit ()
}
}
Opções de linha de comando do IE O Internet Explorer inclui várias opções de linha de comando
que permitem solucionar problemas e configurar o navegador.
Os seguintes pontos descrevem algumas opções de linha de comando com suporte
-private : Usado para iniciar o IE no modo de navegação privada. Isso funciona para o IE 8 e versões posteriores.
-k : Inicia o Internet Explorer no modo quiosque.
O navegador é aberto em uma janela maximizada que não exibe a barra de endereço, os botões de navegação ou a barra de status.
-extoff : Inicia o IE no modo sem add-on.
Esta opção é usada especificamente para solucionar problemas com complementos do navegador. Funciona no IE 7 e versões posteriores.
Nota: forceCreateProcessApi deve ser habilitado para que os argumentos da linha de comando funcionem.
Java
Python
CSharp
Ruby
JavaScript
Kotlin import org.openqa.selenium.Capabilities ;
import org.openqa.selenium.ie.InternetExplorerDriver ;
import org.openqa.selenium.ie.InternetExplorerOptions ;
public class ieTest {
public static void main ( String [] args ) {
InternetExplorerOptions options = new InternetExplorerOptions ();
options . useCreateProcessApiToLaunchIe ();
options . addCommandSwitches ( "-k" );
InternetExplorerDriver driver = new InternetExplorerDriver ( options );
try {
driver . get ( "https://google.com/ncr" );
Capabilities caps = driver . getCapabilities ();
System . out . println ( caps );
} finally {
driver . quit ();
}
}
}
/examples/python/tests/browsers/test_internet_explorer.py
Copy
Close
import sys
import pytest
from selenium import webdriver
from selenium.webdriver.ie.options import Options as InternetExplorerOptions
@pytest.mark.skipif ( sys . platform != "win32" , reason = "requires Windows" )
def test_basic_options ():
options = InternetExplorerOptions ()
driver = webdriver . Ie ( options = options )
driver . quit ()
using System ;
using OpenQA.Selenium ;
using OpenQA.Selenium.IE ;
namespace ieTest {
class Program {
static void Main ( string [] args ) {
InternetExplorerOptions options = new InternetExplorerOptions ();
options . ForceCreateProcessApi = true ;
options . BrowserCommandLineArguments = "-k" ;
IWebDriver driver = new InternetExplorerDriver ( options );
driver . Url = "https://google.com/ncr" ;
}
}
}
/examples/ruby/spec/browsers/internet_explorer_spec.rb
Copy
Close
# frozen_string_literal: true
require 'spec_helper'
RSpec . describe 'Internet Explorer' , exclusive : { platform : :windows } do
it 'basic options' do
options = Selenium :: WebDriver :: Options . ie
@driver = Selenium :: WebDriver . for :ie , options : options
end
end
const ie = require ( 'selenium-webdriver/ie' );
let options = new ie . Options ();
options . addBrowserCommandSwitches ( '-k' );
options . addBrowserCommandSwitches ( '-private' );
options . forceCreateProcessApi ( true );
driver = await env . builder ()
. setIeOptions ( options )
. build ();
import org.openqa.selenium.Capabilities
import org.openqa.selenium.ie.InternetExplorerDriver
import org.openqa.selenium.ie.InternetExplorerOptions
fun main () {
val options = InternetExplorerOptions ()
options . useCreateProcessApiToLaunchIe ()
options . addCommandSwitches ( "-k" )
val driver = InternetExplorerDriver ( options )
try {
driver . get ( "https://google.com/ncr" )
val caps = driver . getCapabilities ()
println ( caps )
} finally {
driver . quit ()
}
}
forceCreateProcessApi Força a inicialização do Internet Explorer
usando a API CreateProcess. O valor padrão é falso.
Para IE 8 e superior, esta opção requer que
o valor de registro “TabProcGrowth” seja definido como 0.
Java
Python
CSharp
Ruby
JavaScript
Kotlin import org.openqa.selenium.Capabilities ;
import org.openqa.selenium.ie.InternetExplorerDriver ;
import org.openqa.selenium.ie.InternetExplorerOptions ;
public class ieTest {
public static void main ( String [] args ) {
InternetExplorerOptions options = new InternetExplorerOptions ();
options . useCreateProcessApiToLaunchIe ();
InternetExplorerDriver driver = new InternetExplorerDriver ( options );
try {
driver . get ( "https://google.com/ncr" );
Capabilities caps = driver . getCapabilities ();
System . out . println ( caps );
} finally {
driver . quit ();
}
}
}
/examples/python/tests/browsers/test_internet_explorer.py
Copy
Close
import sys
import pytest
from selenium import webdriver
from selenium.webdriver.ie.options import Options as InternetExplorerOptions
@pytest.mark.skipif ( sys . platform != "win32" , reason = "requires Windows" )
def test_basic_options ():
options = InternetExplorerOptions ()
driver = webdriver . Ie ( options = options )
driver . quit ()
using System ;
using OpenQA.Selenium ;
using OpenQA.Selenium.IE ;
namespace ieTest {
class Program {
static void Main ( string [] args ) {
InternetExplorerOptions options = new InternetExplorerOptions ();
options . ForceCreateProcessApi = true ;
IWebDriver driver = new InternetExplorerDriver ( options );
driver . Url = "https://google.com/ncr" ;
}
}
}
/examples/ruby/spec/browsers/internet_explorer_spec.rb
Copy
Close
# frozen_string_literal: true
require 'spec_helper'
RSpec . describe 'Internet Explorer' , exclusive : { platform : :windows } do
it 'basic options' do
options = Selenium :: WebDriver :: Options . ie
@driver = Selenium :: WebDriver . for :ie , options : options
end
end
const ie = require ( 'selenium-webdriver/ie' );
let options = new ie . Options ();
options . forceCreateProcessApi ( true );
driver = await env . builder ()
. setIeOptions ( options )
. build ();
import org.openqa.selenium.Capabilities
import org.openqa.selenium.ie.InternetExplorerDriver
import org.openqa.selenium.ie.InternetExplorerOptions
fun main () {
val options = InternetExplorerOptions ()
options . useCreateProcessApiToLaunchIe ()
val driver = InternetExplorerDriver ( options )
try {
driver . get ( "https://google.com/ncr" )
val caps = driver . getCapabilities ()
println ( caps )
} finally {
driver . quit ()
}
}
Service 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:
Java
Python
CSharp
Ruby
JavaScript
Kotlin Selenium v4.10
/examples/java/src/test/java/dev/selenium/browsers/InternetExplorerTest.java
Copy
Close
package dev.selenium.browsers ;
import org.junit.jupiter.api.AfterEach ;
import org.junit.jupiter.api.Test ;
import org.junit.jupiter.api.condition.EnabledOnOs ;
import org.junit.jupiter.api.condition.OS ;
import org.openqa.selenium.ie.InternetExplorerDriver ;
import org.openqa.selenium.ie.InternetExplorerOptions ;
@EnabledOnOs ( OS . WINDOWS )
public class InternetExplorerTest {
public InternetExplorerDriver driver ;
@AfterEach
public void quit () {
driver . quit ();
}
@Test
public void basicOptions () {
InternetExplorerOptions options = new InternetExplorerOptions ();
driver = new InternetExplorerDriver ( options );
}
}
Note : Java also allows setting file output by System Property: Property key: InternetExplorerDriverService.IE_DRIVER_LOGFILE_PROPERTY
Property value: String representing path to log file
/examples/python/tests/browsers/test_internet_explorer.py
Copy
Close
import sys
import pytest
from selenium import webdriver
from selenium.webdriver.ie.options import Options as InternetExplorerOptions
@pytest.mark.skipif ( sys . platform != "win32" , reason = "requires Windows" )
def test_basic_options ():
options = InternetExplorerOptions ()
driver = webdriver . Ie ( options = options )
driver . quit ()
Selenium v4.10
/examples/ruby/spec/browsers/internet_explorer_spec.rb
Copy
Close
# frozen_string_literal: true
require 'spec_helper'
RSpec . describe 'Internet Explorer' , exclusive : { platform : :windows } do
it 'basic options' do
options = Selenium :: WebDriver :: Options . ie
@driver = Selenium :: WebDriver . for :ie , options : options
end
end
Console output To change the logging output to display in the console as STDOUT:
Java
Python
CSharp
Ruby
JavaScript
Kotlin Selenium v4.10
/examples/java/src/test/java/dev/selenium/browsers/InternetExplorerTest.java
Copy
Close
package dev.selenium.browsers ;
import org.junit.jupiter.api.AfterEach ;
import org.junit.jupiter.api.Test ;
import org.junit.jupiter.api.condition.EnabledOnOs ;
import org.junit.jupiter.api.condition.OS ;
import org.openqa.selenium.ie.InternetExplorerDriver ;
import org.openqa.selenium.ie.InternetExplorerOptions ;
@EnabledOnOs ( OS . WINDOWS )
public class InternetExplorerTest {
public InternetExplorerDriver driver ;
@AfterEach
public void quit () {
driver . quit ();
}
@Test
public void basicOptions () {
InternetExplorerOptions options = new InternetExplorerOptions ();
driver = new InternetExplorerDriver ( options );
}
}
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
Selenium v4.11
/examples/python/tests/browsers/test_internet_explorer.py
Copy
Close
import sys
import pytest
from selenium import webdriver
from selenium.webdriver.ie.options import Options as InternetExplorerOptions
@pytest.mark.skipif ( sys . platform != "win32" , reason = "requires Windows" )
def test_basic_options ():
options = InternetExplorerOptions ()
driver = webdriver . Ie ( options = options )
driver . quit ()
Selenium v4.10
/examples/ruby/spec/browsers/internet_explorer_spec.rb
Copy
Close
# frozen_string_literal: true
require 'spec_helper'
RSpec . describe 'Internet Explorer' , exclusive : { platform : :windows } do
it 'basic options' do
options = Selenium :: WebDriver :: Options . ie
@driver = Selenium :: WebDriver . for :ie , options : options
end
end
Log Level There are 6 available log levels: FATAL
, ERROR
, WARN
, INFO
, DEBUG
, and TRACE
If logging output is specified, the default level is FATAL
Java
Python
CSharp
Ruby
JavaScript
Kotlin /examples/java/src/test/java/dev/selenium/browsers/InternetExplorerTest.java
Copy
Close
package dev.selenium.browsers ;
import org.junit.jupiter.api.AfterEach ;
import org.junit.jupiter.api.Test ;
import org.junit.jupiter.api.condition.EnabledOnOs ;
import org.junit.jupiter.api.condition.OS ;
import org.openqa.selenium.ie.InternetExplorerDriver ;
import org.openqa.selenium.ie.InternetExplorerOptions ;
@EnabledOnOs ( OS . WINDOWS )
public class InternetExplorerTest {
public InternetExplorerDriver driver ;
@AfterEach
public void quit () {
driver . quit ();
}
@Test
public void basicOptions () {
InternetExplorerOptions options = new InternetExplorerOptions ();
driver = new InternetExplorerDriver ( options );
}
}
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
/examples/python/tests/browsers/test_internet_explorer.py
Copy
Close
import sys
import pytest
from selenium import webdriver
from selenium.webdriver.ie.options import Options as InternetExplorerOptions
@pytest.mark.skipif ( sys . platform != "win32" , reason = "requires Windows" )
def test_basic_options ():
options = InternetExplorerOptions ()
driver = webdriver . Ie ( options = options )
driver . quit ()
/examples/dotnet/SeleniumDocs/Browsers/InternetExplorerTest.cs
Copy
Close
using System ;
using System.IO ;
using Microsoft.VisualStudio.TestTools.UnitTesting ;
using OpenQA.Selenium.IE ;
using SeleniumDocs.TestSupport ;
namespace SeleniumDocs.Browsers
{
[TestClassCustom]
[EnabledOnOs("WINDOWS")]
public class InternetExplorerTest
{
[TestMethod]
public void BasicOptions ()
{
var options = new InternetExplorerOptions ();
var driver = new InternetExplorerDriver ( options );
driver . Quit ();
}
}
}
Selenium v4.10
/examples/ruby/spec/browsers/internet_explorer_spec.rb
Copy
Close
# frozen_string_literal: true
require 'spec_helper'
RSpec . describe 'Internet Explorer' , exclusive : { platform : :windows } do
it 'basic options' do
options = Selenium :: WebDriver :: Options . ie
@driver = Selenium :: WebDriver . for :ie , options : options
end
end
Supporting Files Path
Java
Python
CSharp
Ruby
JavaScript
Kotlin /examples/java/src/test/java/dev/selenium/browsers/InternetExplorerTest.java
Copy
Close
package dev.selenium.browsers ;
import org.junit.jupiter.api.AfterEach ;
import org.junit.jupiter.api.Test ;
import org.junit.jupiter.api.condition.EnabledOnOs ;
import org.junit.jupiter.api.condition.OS ;
import org.openqa.selenium.ie.InternetExplorerDriver ;
import org.openqa.selenium.ie.InternetExplorerOptions ;
@EnabledOnOs ( OS . WINDOWS )
public class InternetExplorerTest {
public InternetExplorerDriver driver ;
@AfterEach
public void quit () {
driver . quit ();
}
@Test
public void basicOptions () {
InternetExplorerOptions options = new InternetExplorerOptions ();
driver = new InternetExplorerDriver ( options );
}
}
**Note**: Java also allows setting log level by System Property:\
Property key: `InternetExplorerDriverService.IE_DRIVER_EXTRACT_PATH_PROPERTY`\
Property value: String representing path to supporting files directory
Selenium v4.11
/examples/python/tests/browsers/test_internet_explorer.py
Copy
Close
import sys
import pytest
from selenium import webdriver
from selenium.webdriver.ie.options import Options as InternetExplorerOptions
@pytest.mark.skipif ( sys . platform != "win32" , reason = "requires Windows" )
def test_basic_options ():
options = InternetExplorerOptions ()
driver = webdriver . Ie ( options = options )
driver . quit ()
/examples/dotnet/SeleniumDocs/Browsers/InternetExplorerTest.cs
Copy
Close
using System ;
using System.IO ;
using Microsoft.VisualStudio.TestTools.UnitTesting ;
using OpenQA.Selenium.IE ;
using SeleniumDocs.TestSupport ;
namespace SeleniumDocs.Browsers
{
[TestClassCustom]
[EnabledOnOs("WINDOWS")]
public class InternetExplorerTest
{
[TestMethod]
public void BasicOptions ()
{
var options = new InternetExplorerOptions ();
var driver = new InternetExplorerDriver ( options );
driver . Quit ();
}
}
}
Selenium v4.8
/examples/ruby/spec/browsers/internet_explorer_spec.rb
Copy
Close
# frozen_string_literal: true
require 'spec_helper'
RSpec . describe 'Internet Explorer' , exclusive : { platform : :windows } do
it 'basic options' do
options = Selenium :: WebDriver :: Options . ie
@driver = Selenium :: WebDriver . for :ie , options : options
end
end