or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

edge-driver-info.mdedge-driver-service.mdedge-driver.mdedge-options.mdindex.md

edge-driver-service.mddocs/

0

# Edge Driver Service

1

2

EdgeDriverService manages the lifecycle of the EdgeDriver executable (msedgedriver) with extensive configuration options for logging, networking, security, and operational behavior. It handles automatic driver detection, port management, and process lifecycle.

3

4

## Capabilities

5

6

### EdgeDriverService Class

7

8

Service management class for EdgeDriver executable lifecycle and configuration.

9

10

```java { .api }

11

/**

12

* Manages the life and death of the MSEdgeDriver executable

13

*/

14

public class EdgeDriverService extends DriverService {

15

public static final String EDGE_DRIVER_NAME = "msedgedriver";

16

public static final String EDGE_DRIVER_EXE_PROPERTY = "webdriver.edge.driver";

17

public static final String EDGE_DRIVER_READABLE_TIMESTAMP = "webdriver.edge.readableTimestamp";

18

public static final String EDGE_DRIVER_LOG_PROPERTY = "webdriver.edge.logfile";

19

public static final String EDGE_DRIVER_LOG_LEVEL_PROPERTY = "webdriver.edge.loglevel";

20

public static final String EDGE_DRIVER_APPEND_LOG_PROPERTY = "webdriver.edge.appendLog";

21

public static final String EDGE_DRIVER_VERBOSE_LOG_PROPERTY = "webdriver.edge.verboseLogging";

22

public static final String EDGE_DRIVER_SILENT_OUTPUT_PROPERTY = "webdriver.edge.silentOutput";

23

public static final String EDGE_DRIVER_ALLOWED_IPS_PROPERTY = "webdriver.edge.withAllowedIps";

24

public static final String EDGE_DRIVER_DISABLE_BUILD_CHECK = "webdriver.edge.disableBuildCheck";

25

26

/**

27

* Creates EdgeDriverService with full configuration

28

* @param executable EdgeDriver executable file

29

* @param port Port number for the service

30

* @param timeout Timeout for driver startup

31

* @param args Command line arguments for the driver

32

* @param environment Environment variables for the driver process

33

*/

34

public EdgeDriverService(File executable, int port, Duration timeout,

35

List<String> args, Map<String, String> environment) throws IOException;

36

37

/**

38

* Gets the driver executable name

39

* @return "msedgedriver"

40

*/

41

public String getDriverName();

42

43

/**

44

* Gets the system property key for driver executable location

45

* @return "webdriver.edge.driver"

46

*/

47

public String getDriverProperty();

48

49

/**

50

* Gets default driver options

51

* @return new EdgeOptions instance

52

*/

53

public Capabilities getDefaultDriverOptions();

54

55

/**

56

* Creates service with default configuration

57

* @return EdgeDriverService with default settings

58

*/

59

public static EdgeDriverService createDefaultService();

60

}

61

```

62

63

**Usage Examples:**

64

65

```java

66

import org.openqa.selenium.edge.EdgeDriverService;

67

import java.time.Duration;

68

import java.util.Arrays;

69

import java.util.HashMap;

70

71

// Default service

72

EdgeDriverService service = EdgeDriverService.createDefaultService();

73

74

// Custom service with full configuration

75

File executable = new File("/path/to/msedgedriver");

76

int port = 9515;

77

Duration timeout = Duration.ofSeconds(30);

78

List<String> args = Arrays.asList("--port=9515", "--verbose");

79

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

80

env.put("DISPLAY", ":0");

81

82

EdgeDriverService customService = new EdgeDriverService(

83

executable, port, timeout, args, env

84

);

85

```

86

87

### Service Builder

88

89

Builder class for creating configured EdgeDriverService instances.

90

91

```java { .api }

92

/**

93

* Builder for configuring EdgeDriverService instances

94

*/

95

public static class Builder extends DriverService.Builder<EdgeDriverService, Builder> {

96

/**

97

* Configures log file appending behavior

98

* @param appendLog true to append to existing log file

99

* @return this Builder instance for method chaining

100

*/

101

public Builder withAppendLog(boolean appendLog);

102

103

/**

104

* Disables build version compatibility checking

105

* @param noBuildCheck true to disable build version checks

106

* @return this Builder instance for method chaining

107

*/

108

public Builder withBuildCheckDisabled(boolean noBuildCheck);

109

110

/**

111

* Sets driver logging level

112

* @param logLevel ChromiumDriverLogLevel for output verbosity

113

* @return this Builder instance for method chaining

114

*/

115

public Builder withLoglevel(ChromiumDriverLogLevel logLevel);

116

117

/**

118

* Configures silent output mode

119

* @param silent true to suppress driver output

120

* @return this Builder instance for method chaining

121

*/

122

public Builder withSilent(boolean silent);

123

124

/**

125

* Configures verbose output mode

126

* @param verbose true to enable detailed driver output

127

* @return this Builder instance for method chaining

128

*/

129

public Builder withVerbose(boolean verbose);

130

131

/**

132

* Sets allowed IP addresses for connections

133

* @param allowedListIps comma-separated list of allowed IPv4 addresses

134

* @return this Builder instance for method chaining

135

*/

136

public Builder withAllowedListIps(String allowedListIps);

137

138

/**

139

* Configures timestamp format in logs

140

* @param readableTimestamp true for human-readable timestamps

141

* @return this Builder instance for method chaining

142

*/

143

public Builder withReadableTimestamp(Boolean readableTimestamp);

144

145

/**

146

* Builds the configured EdgeDriverService

147

* @return configured EdgeDriverService instance

148

*/

149

public EdgeDriverService build();

150

}

151

```

152

153

**Usage Examples:**

154

155

```java

156

import org.openqa.selenium.edge.EdgeDriverService;

157

import org.openqa.selenium.chromium.ChromiumDriverLogLevel;

158

159

// Basic builder usage

160

EdgeDriverService service = new EdgeDriverService.Builder()

161

.usingPort(9515)

162

.build();

163

164

// Advanced configuration

165

EdgeDriverService advancedService = new EdgeDriverService.Builder()

166

.usingDriverExecutable(new File("/custom/path/msedgedriver"))

167

.usingPort(4444)

168

.withTimeout(Duration.ofSeconds(60))

169

.withLogFile(new File("edge-driver.log"))

170

.withLoglevel(ChromiumDriverLogLevel.DEBUG)

171

.withVerbose(true)

172

.withAppendLog(true)

173

.withReadableTimestamp(true)

174

.withAllowedListIps("127.0.0.1,192.168.1.100")

175

.withBuildCheckDisabled(true)

176

.build();

177

178

// Use with EdgeDriver

179

EdgeDriver driver = new EdgeDriver(advancedService);

180

```

181

182

### Inherited DriverService Methods

183

184

EdgeDriverService inherits standard service lifecycle methods:

185

186

```java { .api }

187

/**

188

* Starts the driver service

189

* @throws IOException if service cannot be started

190

*/

191

public void start() throws IOException;

192

193

/**

194

* Stops the driver service

195

*/

196

public void stop();

197

198

/**

199

* Checks if service is currently running

200

* @return true if service is running

201

*/

202

public boolean isRunning();

203

204

/**

205

* Gets the service URL

206

* @return URL of the running service

207

*/

208

public URL getUrl();

209

210

/**

211

* Gets the service port

212

* @return port number of the service

213

*/

214

public int getPort();

215

216

/**

217

* Gets command line arguments used to start the service

218

* @return list of command line arguments

219

*/

220

public List<String> getArgs();

221

```

222

223

**Usage Examples:**

224

225

```java

226

EdgeDriverService service = EdgeDriverService.createDefaultService();

227

228

// Manual service lifecycle management

229

service.start();

230

boolean running = service.isRunning();

231

URL serviceUrl = service.getUrl();

232

int port = service.getPort();

233

234

// Use service with driver

235

EdgeDriver driver = new EdgeDriver(service);

236

driver.get("https://example.com");

237

driver.quit();

238

239

// Stop service when done

240

service.stop();

241

```

242

243

### Builder Inherited Methods

244

245

Builder inherits configuration methods from DriverService.Builder:

246

247

```java { .api }

248

/**

249

* Sets the driver executable file

250

* @param file Driver executable file

251

* @return this Builder instance for method chaining

252

*/

253

public Builder usingDriverExecutable(File file);

254

255

/**

256

* Sets the service port number

257

* @param port Port number for the service

258

* @return this Builder instance for method chaining

259

*/

260

public Builder usingPort(int port);

261

262

/**

263

* Sets any free port for the service

264

* @return this Builder instance for method chaining

265

*/

266

public Builder usingAnyFreePort();

267

268

/**

269

* Sets service startup timeout

270

* @param timeout Duration to wait for service startup

271

* @return this Builder instance for method chaining

272

*/

273

public Builder withTimeout(Duration timeout);

274

275

/**

276

* Sets log file for driver output

277

* @param logFile File to write driver logs

278

* @return this Builder instance for method chaining

279

*/

280

public Builder withLogFile(File logFile);

281

282

/**

283

* Sets environment variables for driver process

284

* @param environment Map of environment variable names to values

285

* @return this Builder instance for method chaining

286

*/

287

public Builder withEnvironment(Map<String, String> environment);

288

```

289

290

**Usage Examples:**

291

292

```java

293

EdgeDriverService service = new EdgeDriverService.Builder()

294

.usingDriverExecutable(new File("/opt/msedgedriver"))

295

.usingPort(8080)

296

.withTimeout(Duration.ofMinutes(2))

297

.withLogFile(new File("/var/log/edge-driver.log"))

298

.withEnvironment(Map.of(

299

"DISPLAY", ":1",

300

"LANG", "en_US.UTF-8"

301

))

302

.build();

303

```

304

305

### Log Level Configuration

306

307

Configure driver logging behavior with ChromiumDriverLogLevel:

308

309

```java { .api }

310

// Log levels

311

enum ChromiumDriverLogLevel {

312

OFF, SEVERE, WARNING, INFO, DEBUG, ALL

313

}

314

```

315

316

**Usage Examples:**

317

318

```java

319

// Different logging configurations

320

EdgeDriverService debugService = new EdgeDriverService.Builder()

321

.withLoglevel(ChromiumDriverLogLevel.DEBUG)

322

.withVerbose(true)

323

.withLogFile(new File("debug.log"))

324

.build();

325

326

EdgeDriverService silentService = new EdgeDriverService.Builder()

327

.withLoglevel(ChromiumDriverLogLevel.OFF)

328

.withSilent(true)

329

.build();

330

331

EdgeDriverService infoService = new EdgeDriverService.Builder()

332

.withLoglevel(ChromiumDriverLogLevel.INFO)

333

.withReadableTimestamp(true)

334

.withAppendLog(false)

335

.build();

336

```

337

338

### System Property Integration

339

340

EdgeDriverService automatically reads configuration from system properties:

341

342

```java

343

// Set system properties before creating service

344

System.setProperty("webdriver.edge.driver", "/path/to/msedgedriver");

345

System.setProperty("webdriver.edge.logfile", "/var/log/edge.log");

346

System.setProperty("webdriver.edge.loglevel", "DEBUG");

347

System.setProperty("webdriver.edge.verboseLogging", "true");

348

System.setProperty("webdriver.edge.silentOutput", "false");

349

System.setProperty("webdriver.edge.withAllowedIps", "127.0.0.1");

350

System.setProperty("webdriver.edge.disableBuildCheck", "true");

351

System.setProperty("webdriver.edge.readableTimestamp", "true");

352

System.setProperty("webdriver.edge.appendLog", "true");

353

354

// Service will automatically use these properties

355

EdgeDriverService service = EdgeDriverService.createDefaultService();

356

```

357

358

### Error Handling

359

360

EdgeDriverService throws standard exceptions:

361

362

```java { .api }

363

// Common exceptions

364

IOException - When service cannot start or stop

365

WebDriverException - General service-related errors

366

IllegalStateException - When service is in invalid state

367

```

368

369

**Usage Examples:**

370

371

```java

372

try {

373

EdgeDriverService service = new EdgeDriverService.Builder()

374

.usingPort(9515)

375

.withLogFile(new File("/invalid/path/edge.log"))

376

.build();

377

378

service.start();

379

EdgeDriver driver = new EdgeDriver(service);

380

381

} catch (IOException e) {

382

System.err.println("Failed to start service: " + e.getMessage());

383

} catch (WebDriverException e) {

384

System.err.println("Driver service error: " + e.getMessage());

385

} finally {

386

if (service != null && service.isRunning()) {

387

service.stop();

388

}

389

}

390

```

391

392

## Types

393

394

```java { .api }

395

import org.openqa.selenium.remote.service.DriverService;

396

import org.openqa.selenium.chromium.ChromiumDriverLogLevel;

397

import org.openqa.selenium.WebDriverException;

398

import java.io.File;

399

import java.io.IOException;

400

import java.time.Duration;

401

import java.util.List;

402

import java.util.Map;

403

import java.net.URL;

404

```