Playwright · Junior · Question 66 of 75

What does page.waitForTimeout(2000) do and why avoid it?

Show the answer

Correct answer: Waits a fixed 2 s; it's slow and still flaky

Explanation

Fixed waits are too long when the app is fast and too short when it's slow. Web-first assertions wait exactly as long as needed.

Further reading

Problem with a question

Playwright · Junior · question 66

Test yourself

Take the Playwright · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz