Skip to content
CodeKruPro

Wait for Element to Appear

38/70

Wait for Element to Appear

Playwright actions like click() and fill() auto-wait for elements. But sometimes you need to explicitly wait using locator.waitFor().

On the Appearing Elements page, #appearing5sec becomes visible after 5 seconds.

Task:

  1. Navigate to https://testkru.com/Interactions/AppearingElements
  2. Wait for #appearing5sec to be visible using waitFor({ state: 'visible' })
  3. Print its text

Expected output:

Appeared: Message appeared after 5 seconds