liveBook · Manning

WebDriver

As explained in Testing Spring Boot Applications

WebDriver is an automation interface that exposes programmatic commands for controlling a web browser and reading or interacting with its pages.

WebDriver is a programmatic interface for controlling a real web browser, sending commands, and reading browser state. It exposes an HTTP interface, while Selenium supplies higher-level APIs for driver lifecycle management and page interaction. section 4.5

A Selenium-based WebDriver setup typically requires:

  • A reachable test application and running web server, because the browser executes outside the test process. section 4.5
  • A browser-specific driver service, such as ChromeDriverService, SafariDriverService, EdgeDriverService, or GeckoDriverService. section 4.5.1
  • Browser lifecycle management, including startup, implicit waits, cookie cleanup when needed, and shutdown. section 4.5.1
  • Headless browser options for CI environments without a display or for local runs that should not open a visible window. section 4.5.1

Headless Chrome setup

A test can start a ChromeDriver service before all tests, create a headless ChromeDriver with a one-second implicit wait, and call driver.quit() and driverService.stop() afterward. Selenium Manager can locate compatible browser and driver executables, download a missing driver, and report selected versions through logging.level.org.openqa.selenium=DEBUG. section 4.5.1

Listing 4.20 Selenium testing dependencies
<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-java</artifactId>
    <scope>test</scope>
</dependency>

Use the dependency listing to add Selenium’s Java integration with test scope. section 4.5

How Testing Spring Boot Applications covers it

How deep it goes
Explains the HTTP interface, W3C specification, browser drivers, lifecycle, headless mode, waits, and executable discovery.
Examples
Uses Selenium Java dependencies, ChromeDriverService, ChromeOptions, implicit waits, cookie deletion, and Selenium Manager logging.
What it assumes
Assumes a network-accessible test application and browser environment, while explaining driver selection and executable discovery.
What you can do after
Operate WebDriver through Selenium to launch, configure, interact with, and shut down a browser for web tests.
How it connects
Connects WebDriver with Selenium, browser-specific drivers, HTTP interfaces, headless browsers, and CI environments.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Testing Spring Boot Applications. The section links point to the parts of the book it draws on.