Architecture

Playwright Architecture

Understand Playwright Architecture through browser, browser context, page, locator, fixtures, projects, reports, and parallel execution.

Object Model

Playwright flows from browser engine to isolated browser context, then to page, locator, action, and assertion.

Lifecycle Flow

Browser -> Browser Context -> Page -> Locator -> Action -> Assertion

How Pieces Connect

  • Browser creates contexts.
  • Context stores isolated session state.
  • Page represents one tab.
  • Locator finds elements at action/assertion time.
  • Test runner controls fixtures, projects, retries, and reports.

Isolation and Parallelism

Browser contexts allow tests to run independently because each context has separate cookies, local storage, permissions, and viewport.

Common Confusion

  • Browser is not the same as page.
  • Context is not the same as tab.
  • Locator is not a fixed DOM element.
  • Fixtures are not page objects.

Interview Angle

A strong Architecture answer explains isolation, auto-waiting, and why Playwright can run reliable parallel tests.