lecture 10 of 220 completed

Assertions come from somewhere else

Selenium has no assertions at all. Understanding why explains the shape of every Selenium project you will join.

What you'll learn

  • Why Selenium has no assertions of its own
  • Why your assertions never retry
  • The wait, read, assert order that prevents flaky tests

Here is something that confuses everyone arriving from Cypress or Playwright.

Selenium has no assertion library. None. There is no expect, no should. Search the documentation and you will not find one.

That is not an omission. Selenium's job is to control a browser. Deciding whether a value is correct is a different job, and it was left to the tools that already did it well.

So a Selenium project has two halves you assemble yourself:

  • Selenium WebDriver finds elements and does things to them.
  • A test framework and assertion library structures the tests and checks the results.

members only

Keep reading with the full course

The Foundations track and the first 5 lectures of each framework are free. This lecture is part of the paid course, which unlocks every lecture, all three frameworks, and downloads.

See the options →