lecture 7 of 220 completed

Finding elements

A locator based on position breaks the next time someone edits the page. Find elements by what they are instead.

What you'll learn

  • Why a position-based selector can pass while pointing at the wrong thing
  • How to target an element by what it is, not where it sits
  • Which selectors to avoid, and why they break

Position-based locators cause a bug that is worse than a failing test. Here it is.

A test adds the first product to the cart:

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 →