or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

index.mdoptions.mdservice.mdwebdriver.md

service.mddocs/

0

# Service Management

1

2

Service lifecycle management for the IEDriverServer executable, including process creation, configuration, and cleanup. The InternetExplorerDriverService class manages the IEDriverServer process that communicates between WebDriver and Internet Explorer.

3

4

## Capabilities

5

6

### InternetExplorerDriverService Class

7

8

Main service class for managing IEDriverServer process lifecycle.

9

10

```java { .api }

11

/**

12

* Manages the life and death of an IEDriverServer process.

13

* Extends DriverService to provide IE-specific functionality.

14

*/

15

public class InternetExplorerDriverService extends DriverService {

16

17

/**

18

* Creates InternetExplorerDriverService with full configuration.

19

* @param executable The IEDriverServer executable file

20

* @param port Port number for the driver server

21

* @param timeout Timeout waiting for driver server to start

22

* @param args Command line arguments for the server

23

* @param environment Environment variables for the server process

24

* @throws IOException If an I/O error occurs during service creation

25

*/

26

public InternetExplorerDriverService(

27

File executable,

28

int port,

29

Duration timeout,

30

List<String> args,

31

Map<String, String> environment

32

) throws IOException;

33

34

/**

35

* Returns the driver executable name.

36

* @return "IEDriverServer"

37

*/

38

public String getDriverName();

39

40

/**

41

* Returns the system property name for driver executable path.

42

* @return "webdriver.ie.driver"

43

*/

44

public String getDriverProperty();

45

46

/**

47

* Returns default driver options for this service.

48

* @return New InternetExplorerOptions instance

49

*/

50

@Override

51

public Capabilities getDefaultDriverOptions();

52

53

/**

54

* Creates a default InternetExplorerDriverService instance.

55

* Uses default configuration with free port and default executable path.

56

* @return Configured InternetExplorerDriverService instance

57

*/

58

public static InternetExplorerDriverService createDefaultService();

59

}

60

```

61

62

### Service Constants

63

64

System property constants for configuring IEDriverServer behavior.

65

66

```java { .api }

67

/**

68

* System property constants for IE driver service configuration.

69

*/

70

public static final String IE_DRIVER_NAME = "IEDriverServer";

71

public static final String IE_DRIVER_EXE_PROPERTY = "webdriver.ie.driver";

72

public static final String IE_DRIVER_LOGFILE_PROPERTY = "webdriver.ie.driver.logfile";

73

public static final String IE_DRIVER_LOGLEVEL_PROPERTY = "webdriver.ie.driver.loglevel";

74

public static final String IE_DRIVER_HOST_PROPERTY = "webdriver.ie.driver.host";

75

public static final String IE_DRIVER_EXTRACT_PATH_PROPERTY = "webdriver.ie.driver.extractpath";

76

public static final String IE_DRIVER_SILENT_PROPERTY = "webdriver.ie.driver.silent";

77

```

78

79

### Service Builder

80

81

Builder pattern implementation for configuring InternetExplorerDriverService instances.

82

83

```java { .api }

84

/**

85

* Builder for configuring InternetExplorerDriverService instances.

86

* Provides fluent API for service configuration.

87

*/

88

@AutoService(DriverService.Builder.class)

89

public static class Builder extends DriverService.Builder<

90

InternetExplorerDriverService,

91

InternetExplorerDriverService.Builder

92

> {

93

94

/**

95

* Scores capability compatibility for this driver service.

96

* Higher scores indicate better compatibility.

97

* @param capabilities WebDriver capabilities to evaluate

98

* @return Compatibility score (0 = not compatible, higher = more compatible)

99

*/

100

@Override

101

public int score(Capabilities capabilities);

102

103

/**

104

* Configures the logging level for the driver server.

105

* @param logLevel Log verbosity level

106

* @return Builder instance for method chaining

107

*/

108

public Builder withLogLevel(InternetExplorerDriverLogLevel logLevel);

109

110

/**

111

* Configures the host to which the driver server will be bound.

112

* @param host Host name or IP address

113

* @return Builder instance for method chaining

114

*/

115

public Builder withHost(String host);

116

117

/**

118

* Configures path where driver server library will be extracted.

119

* @param extractPath Directory path for extraction

120

* @return Builder instance for method chaining

121

*/

122

public Builder withExtractPath(File extractPath);

123

124

/**

125

* Configures silence mode for driver server stdout.

126

* @param silent True to suppress unlogged messages to stdout

127

* @return Builder instance for method chaining

128

*/

129

public Builder withSilent(Boolean silent);

130

}

131

```

132

133

## Usage Examples

134

135

### Default Service Creation

136

137

```java

138

import org.openqa.selenium.ie.InternetExplorerDriverService;

139

import org.openqa.selenium.ie.InternetExplorerDriver;

140

141

// Create default service

142

InternetExplorerDriverService service = InternetExplorerDriverService.createDefaultService();

143

144

// Use with driver

145

WebDriver driver = new InternetExplorerDriver(service);

146

```

147

148

### Custom Service Configuration

149

150

```java

151

import org.openqa.selenium.ie.InternetExplorerDriverService;

152

import org.openqa.selenium.ie.InternetExplorerDriverLogLevel;

153

import java.io.File;

154

155

// Build custom service

156

InternetExplorerDriverService service = new InternetExplorerDriverService.Builder()

157

.withLogLevel(InternetExplorerDriverLogLevel.INFO)

158

.withHost("localhost")

159

.withExtractPath(new File("C:\\temp\\iedriver"))

160

.withSilent(false)

161

.build();

162

163

WebDriver driver = new InternetExplorerDriver(service);

164

```

165

166

### System Property Configuration

167

168

```java

169

// Set system properties before service creation

170

System.setProperty("webdriver.ie.driver", "C:\\drivers\\IEDriverServer.exe");

171

System.setProperty("webdriver.ie.driver.logfile", "C:\\logs\\iedriver.log");

172

System.setProperty("webdriver.ie.driver.loglevel", "INFO");

173

System.setProperty("webdriver.ie.driver.host", "127.0.0.1");

174

175

// Service will use system properties

176

InternetExplorerDriverService service = InternetExplorerDriverService.createDefaultService();

177

```

178

179

### Manual Service Construction

180

181

```java

182

import java.time.Duration;

183

import java.util.Arrays;

184

import java.util.HashMap;

185

186

// Manual service construction with full control

187

File executable = new File("C:\\drivers\\IEDriverServer.exe");

188

int port = 9515;

189

Duration timeout = Duration.ofSeconds(30);

190

List<String> args = Arrays.asList(

191

"--port=9515",

192

"--log-level=INFO",

193

"--host=localhost"

194

);

195

Map<String, String> environment = new HashMap<>();

196

environment.put("PATH", System.getenv("PATH"));

197

198

InternetExplorerDriverService service = new InternetExplorerDriverService(

199

executable, port, timeout, args, environment

200

);

201

```

202

203

## Log Level Configuration

204

205

The InternetExplorerDriverLogLevel enum provides different verbosity levels:

206

207

```java { .api }

208

/**

209

* Log level enumeration for IEDriverServer logging.

210

*/

211

public enum InternetExplorerDriverLogLevel {

212

TRACE, // Most verbose - traces all operations

213

DEBUG, // Debug information for troubleshooting

214

INFO, // General information about operations

215

WARN, // Warning messages for potential issues

216

ERROR, // Error messages for failures

217

FATAL // Critical errors that cause termination

218

}

219

```

220

221

**Usage:**

222

223

```java

224

InternetExplorerDriverService service = new InternetExplorerDriverService.Builder()

225

.withLogLevel(InternetExplorerDriverLogLevel.DEBUG)

226

.build();

227

```

228

229

## Service Lifecycle Management

230

231

### Automatic Management

232

233

When using InternetExplorerDriver constructors, the service is automatically managed:

234

235

```java

236

// Service automatically started and stopped

237

WebDriver driver = new InternetExplorerDriver();

238

// ... use driver

239

driver.quit(); // Service automatically stopped

240

```

241

242

### Manual Management

243

244

For more control over service lifecycle:

245

246

```java

247

InternetExplorerDriverService service = new InternetExplorerDriverService.Builder()

248

.withLogLevel(InternetExplorerDriverLogLevel.INFO)

249

.build();

250

251

try {

252

service.start(); // Manually start service

253

254

// Create driver with existing service

255

WebDriver driver = new InternetExplorerDriver(service);

256

257

// ... use driver

258

driver.quit();

259

260

} finally {

261

service.stop(); // Manually stop service

262

}

263

```

264

265

## System Integration

266

267

### Selenium Manager Integration

268

269

The service integrates with Selenium Manager for automatic driver management:

270

271

```java

272

// Selenium Manager automatically downloads and configures IEDriverServer

273

InternetExplorerDriverService service = InternetExplorerDriverService.createDefaultService();

274

// Driver executable is automatically located and configured

275

```

276

277

### Grid Integration

278

279

Services can be configured for Selenium Grid environments:

280

281

```java

282

InternetExplorerDriverService service = new InternetExplorerDriverService.Builder()

283

.withHost("0.0.0.0") // Bind to all interfaces for Grid

284

.withLogLevel(InternetExplorerDriverLogLevel.WARN)

285

.build();

286

```

287

288

## Best Practices

289

290

1. **Resource Management**: Always ensure services are properly stopped to avoid resource leaks

291

2. **Port Configuration**: Use free ports to avoid conflicts in multi-instance environments

292

3. **Logging**: Configure appropriate log levels for debugging vs. production use

293

4. **Host Binding**: Use specific host binding for security in networked environments

294

5. **Timeout Values**: Set reasonable timeouts based on system performance

295

6. **Path Management**: Use absolute paths for executable and extraction directories

296

7. **Environment Variables**: Properly configure PATH and other environment variables

297

8. **Service Reuse**: Consider reusing services across multiple test sessions for efficiency

298

299

## Troubleshooting

300

301

Common service-related issues and solutions:

302

303

**Service Start Failures:**

304

- Verify IEDriverServer.exe is available and executable

305

- Check port availability and permissions

306

- Validate system PATH configuration

307

308

**Communication Issues:**

309

- Verify host and port configuration

310

- Check firewall and network settings

311

- Review log files for detailed error information

312

313

**Performance Issues:**

314

- Adjust timeout values based on system performance

315

- Consider service reuse patterns for test suites

316

- Monitor resource usage and cleanup