lecture 8 of 160 completed

Skipping the login screen

Logging in through the form on every test wastes minutes. Setting the session cookie directly is much faster.

What you'll learn

  • How to skip the login form without weakening coverage
  • Why setting the session directly is faster and steadier
  • Which test must still use the real form

Logging in through the form takes about three seconds. With eighty tests that is four minutes of every run, spent typing the same password.

Selenium has no built-in feature for saving a session, so teams solve it themselves. The usual way is to get the session cookie once, then set it directly in later tests.

Step 1: get the cookie after a real login. Do this once, in a setup step:

full course

Keep reading with the full course

The Foundations track and the first lessons in each framework are free. This lesson needs full course access. A course plan includes all lessons for Playwright, Cypress and Selenium.

See course plans →