BrauzerLab
← Back to missions 22 / 50

`waitForSelector` — The Legacy Pattern

Medium ~150 sec

In test suites that migrated to Playwright you’ll sometimes see this line: page.waitForSelector(...). It’s the legacy pattern that explicitly waits for an element to appear in the DOM.

Modern Playwright already performs automatic waiting (in click(), fill(), and expect() calls) — waitForSelector is usually unnecessary. But complete this mission to recognise it in older codebases.

page is available. Use waitForSelector to wait for the #result element, then click it.

After the mission, read the structuralHints section: what is the modern alternative?

TASK

Use `waitForSelector` to wait for the element to appear, then click it.

Provided for you
import { test, expect } from '@playwright/test';

test('`waitForSelector` — The Legacy Pattern', async ({ page }) => {
  await page.goto('https://lab.local/mission/wait-for-selector');
  // ↓ Your code goes below ↓
});
Editor
https://lab.local/mission/wait-for-selector
Loading...
Results will appear here — press Run or Check.