Playwright · Middle · Question 42 of 75
How do you test how a page behaves offline?
- 1Unplug the CI machine from the network
- 2
await context.setOffline(true) - 3
await page.route('**', r => r.continue())
Show the answer
Correct answer: await context.setOffline(true)
Explanation
Offline mode makes requests fail like real network loss. Combine it with checks of offline banners or retries.