Selenium WebDriver 4

Run tests in parallel threads

Hard120 pts~45 min
  • Parallel execution
  • Thread safety
  • Test isolation
Practice app · Acme Ops

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

Test URL
/lab/selenium-run-tests-in-parallel-threads

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

Objective

Run two independent sign-in tests concurrently, each with its own isolated driver.

Your task

  1. 1Hold the driver per thread (ThreadLocal<WebDriver>, a function-scoped fixture, or one driver per test instance).
  2. 2Test A: sign in and assert the welcome message. Test B: sign in and assert #user-role reads “Administrator”.
  3. 3Enable parallel execution: JUnit 5 junit.jupiter.execution.parallel / @Execution(CONCURRENT), pytest-xdist, NUnit [Parallelizable], or Promise.all with two drivers.
  4. 4Quit each driver in its own teardown.

Acceptance criteria

  • Parallel execution is configured
  • Each test uses its own driver
  • The dashboard is shown
  • At least 2 assertions pass

Fixtures

username
qa@target.dev
password
Test@123

Selenium WebDriver 4 · Selenium · Grid, parallel & CI