Playwright times out after any page.route usage

Viewed 777

When I try to intercept any request using page, playwright just times out, even if nothing is changed:

import {chromium} from "playwright";

const b = await chromium.launch({
    headless: false
})

const p = await b.newPage();
await p.route('**/*', async (route) => {
    await route.continue();
});
await p.goto('https://www.google.com');

I would expect this code to just open google, but the loading spinner spins for a while, then timeout happens. Why?

2 Answers

From the examples here, it looks like the route.continue() should not be awaited (and the handler is not an async function). Maybe that difference explains the timeout?

Related