Selenium WebDriver 4

Run headless in a Docker container

Expert190 pts~70 min
  • Docker
  • Headless browsers
  • Browser options
Practice app · Acme Ops

A sign-in page with field validation and an authenticated dashboard.

Test URL
/lab/sdet-run-headless-in-a-docker-container

Your starter code already declares TEST_URL — never hardcode a host.

Objective

Configure Chrome with the flags needed to run headless inside a container and verify the flow at a fixed resolution.

Your task

  1. 1Create ChromeOptions with --headless=new, --no-sandbox, --disable-dev-shm-usage and --window-size=1920,1080.
  2. 2Optionally connect to a selenium/standalone-chrome container via SELENIUM_REMOTE_URL; otherwise run locally.
  3. 3Sign in with qa@target.dev / Test@123 (#username, #password, #login-button).
  4. 4Assert the dashboard and that the window width is 1920.

Acceptance criteria

  • Headless and container-safe flags are set
  • The dashboard is shown
  • At least 2 assertions pass

Constraints

  • The suite must still pass on the practice runner: fall back to a local Chrome driver when the environment variable is not set.

Fixtures

username
qa@target.dev
password
Test@123

Selenium WebDriver 4 · SDET · Grid, parallel & CI