0
# WebDriver Implementation
1
2
Core WebDriver functionality for creating and managing Internet Explorer browser instances. The InternetExplorerDriver class extends RemoteWebDriver and provides the main entry point for IE automation.
3
4
## Capabilities
5
6
### InternetExplorerDriver Class
7
8
The main WebDriver implementation for Internet Explorer automation.
9
10
```java { .api }
11
/**
12
* WebDriver implementation for Internet Explorer browser automation.
13
* Extends RemoteWebDriver to provide IE-specific functionality.
14
*/
15
public class InternetExplorerDriver extends RemoteWebDriver {
16
17
/**
18
* Creates a new InternetExplorerDriver with default service and options.
19
* Uses createDefaultService() and new InternetExplorerOptions().
20
*/
21
public InternetExplorerDriver();
22
23
/**
24
* Creates a new InternetExplorerDriver with custom options.
25
* Uses default service with provided options.
26
* @param options IE-specific configuration options
27
*/
28
public InternetExplorerDriver(InternetExplorerOptions options);
29
30
/**
31
* Creates a new InternetExplorerDriver with custom service.
32
* Uses provided service with default options.
33
* @param service Custom IE driver service configuration
34
*/
35
public InternetExplorerDriver(InternetExplorerDriverService service);
36
37
/**
38
* Creates a new InternetExplorerDriver with custom service and options.
39
* @param service Custom IE driver service configuration
40
* @param options IE-specific configuration options
41
*/
42
public InternetExplorerDriver(
43
InternetExplorerDriverService service,
44
InternetExplorerOptions options
45
);
46
47
/**
48
* Creates a new InternetExplorerDriver with full configuration.
49
* @param service Custom IE driver service configuration
50
* @param options IE-specific configuration options
51
* @param clientConfig HTTP client configuration for WebDriver communication
52
*/
53
public InternetExplorerDriver(
54
InternetExplorerDriverService service,
55
InternetExplorerOptions options,
56
ClientConfig clientConfig
57
);
58
59
/**
60
* Creates a RemoteWebDriverBuilder for IE driver configuration.
61
* @return Builder instance configured for InternetExplorer
62
*/
63
@Beta
64
public static RemoteWebDriverBuilder builder();
65
66
/**
67
* Overridden to throw WebDriverException - file detection not supported on IE.
68
* @param detector File detector instance
69
* @throws WebDriverException Always thrown as operation is not supported
70
*/
71
@Override
72
public void setFileDetector(FileDetector detector);
73
}
74
```
75
76
**Usage Examples:**
77
78
```java
79
import org.openqa.selenium.ie.InternetExplorerDriver;
80
import org.openqa.selenium.ie.InternetExplorerOptions;
81
import org.openqa.selenium.ie.InternetExplorerDriverService;
82
import org.openqa.selenium.WebDriver;
83
84
// Basic usage with defaults
85
WebDriver driver = new InternetExplorerDriver();
86
87
// With custom options
88
InternetExplorerOptions options = new InternetExplorerOptions()
89
.ignoreZoomSettings()
90
.requireWindowFocus();
91
WebDriver driver = new InternetExplorerDriver(options);
92
93
// With custom service
94
InternetExplorerDriverService service = new InternetExplorerDriverService.Builder()
95
.withLogLevel(InternetExplorerDriverLogLevel.INFO)
96
.build();
97
WebDriver driver = new InternetExplorerDriver(service);
98
99
// Full configuration
100
WebDriver driver = new InternetExplorerDriver(service, options, ClientConfig.defaultConfig());
101
102
// Using builder pattern (Beta)
103
WebDriver driver = InternetExplorerDriver.builder()
104
.oneOf(new InternetExplorerOptions().ignoreZoomSettings())
105
.build();
106
```
107
108
### Capability Constants
109
110
String constants for IE-specific WebDriver capabilities.
111
112
```java { .api }
113
/**
114
* Capability constants for Internet Explorer WebDriver configuration.
115
* These constants are used with InternetExplorerOptions or direct capability setting.
116
*/
117
public static final String IGNORE_ZOOM_SETTING = "ignoreZoomSetting";
118
public static final String INITIAL_BROWSER_URL = "initialBrowserUrl";
119
public static final String ELEMENT_SCROLL_BEHAVIOR = "elementScrollBehavior";
120
public static final String ENABLE_ELEMENT_CACHE_CLEANUP = "enableElementCacheCleanup";
121
public static final String BROWSER_ATTACH_TIMEOUT = "browserAttachTimeout";
122
public static final String INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS = "ignoreProtectedModeSettings";
123
public static final String ENABLE_PERSISTENT_HOVERING = "enablePersistentHover";
124
public static final String REQUIRE_WINDOW_FOCUS = "requireWindowFocus";
125
public static final String FORCE_CREATE_PROCESS = "ie.forceCreateProcessApi";
126
public static final String IE_ENSURE_CLEAN_SESSION = "ie.ensureCleanSession";
127
public static final String IE_USE_PER_PROCESS_PROXY = "ie.usePerProcessProxy";
128
public static final String IE_SWITCHES = "ie.browserCommandLineSwitches";
129
```
130
131
### Platform Validation
132
133
The driver automatically validates platform compatibility.
134
135
```java { .api }
136
/**
137
* Validates that the current platform is Windows.
138
* Called automatically during driver initialization.
139
* @throws WebDriverException if not running on Windows platform
140
*/
141
protected void assertOnWindows();
142
```
143
144
**Platform Requirements:**
145
- Must be running on Windows platform
146
- Internet Explorer must be installed
147
- IEDriverServer.exe must be available (managed by Selenium Manager)
148
149
## Error Conditions
150
151
Common error scenarios and their handling:
152
153
**WebDriverException**: Thrown for general driver errors including:
154
- Running on non-Windows platforms
155
- IE browser not found or cannot be launched
156
- IEDriverServer executable not found or cannot be started
157
- Session creation failures
158
159
**SessionNotCreatedException**: Thrown when IE browser session cannot be created due to:
160
- Browser configuration issues
161
- Security policy restrictions
162
- Resource unavailability
163
164
## Integration with Selenium Grid
165
166
The IE driver can be used with Selenium Grid for distributed testing:
167
168
```java
169
// Grid configuration
170
DesiredCapabilities caps = new DesiredCapabilities();
171
caps.setBrowserName("internet explorer");
172
caps.merge(new InternetExplorerOptions().ignoreZoomSettings());
173
174
WebDriver driver = new RemoteWebDriver(gridUrl, caps);
175
```
176
177
### Driver Information and Metadata
178
179
WebDriverInfo implementation providing metadata and factory functionality for Internet Explorer driver.
180
181
```java { .api }
182
/**
183
* WebDriverInfo implementation for Internet Explorer driver.
184
* Provides metadata, capability checking, and driver instantiation.
185
*/
186
@AutoService(WebDriverInfo.class)
187
public class InternetExplorerDriverInfo implements WebDriverInfo {
188
189
/**
190
* Returns the display name for this driver.
191
* @return "Internet Explorer"
192
*/
193
public String getDisplayName();
194
195
/**
196
* Returns canonical capabilities for IE driver.
197
* @return Capabilities with browser name set to "internet explorer"
198
*/
199
public Capabilities getCanonicalCapabilities();
200
201
/**
202
* Checks if this driver supports the given capabilities.
203
* @param capabilities Capabilities to check
204
* @return true if IE browser or se:ieOptions capability present
205
*/
206
public boolean isSupporting(Capabilities capabilities);
207
208
/**
209
* Indicates CDP (Chrome DevTools Protocol) support.
210
* @return false - IE driver does not support CDP
211
*/
212
public boolean isSupportingCdp();
213
214
/**
215
* Indicates BiDi (Bidirectional WebDriver protocol) support.
216
* @return false - IE driver does not support BiDi
217
*/
218
public boolean isSupportingBiDi();
219
220
/**
221
* Checks if IE driver is available on current platform.
222
* @return true if Windows platform and IEDriverServer is available
223
*/
224
public boolean isAvailable();
225
226
/**
227
* Checks if IE driver executable is present.
228
* @return true if Windows platform and IEDriverServer executable found
229
*/
230
public boolean isPresent();
231
232
/**
233
* Returns maximum simultaneous sessions supported.
234
* @return 1 - IE driver supports only single session
235
*/
236
public int getMaximumSimultaneousSessions();
237
238
/**
239
* Creates IE driver instance with given capabilities.
240
* @param capabilities Capabilities to use
241
* @return Optional containing InternetExplorerDriver or empty if unavailable
242
*/
243
public Optional<WebDriver> createDriver(Capabilities capabilities);
244
}
245
```
246
247
**Usage Examples:**
248
249
```java
250
import org.openqa.selenium.ie.InternetExplorerDriverInfo;
251
import org.openqa.selenium.WebDriverInfo;
252
import org.openqa.selenium.Capabilities;
253
254
// Check driver availability
255
InternetExplorerDriverInfo driverInfo = new InternetExplorerDriverInfo();
256
if (driverInfo.isAvailable()) {
257
System.out.println("IE driver is available");
258
System.out.println("Display name: " + driverInfo.getDisplayName());
259
System.out.println("Max sessions: " + driverInfo.getMaximumSimultaneousSessions());
260
}
261
262
// Check capability support
263
Capabilities caps = new DesiredCapabilities();
264
caps.setCapability("browserName", "internet explorer");
265
if (driverInfo.isSupporting(caps)) {
266
Optional<WebDriver> driver = driverInfo.createDriver(caps);
267
if (driver.isPresent()) {
268
// Use the driver
269
driver.get().quit();
270
}
271
}
272
```
273
274
## Best Practices
275
276
1. **Always call quit()**: Ensure proper cleanup of IE processes
277
2. **Use appropriate options**: Configure zoom, focus, and security settings based on your test environment
278
3. **Handle platform checks**: Wrap IE driver usage in platform-specific conditions
279
4. **Service lifecycle**: Properly manage service creation and cleanup
280
5. **Error handling**: Catch and handle WebDriverException for robustness