In the following code (which uses Playwright), only the last HTTP request is intercepted:
test('experimental test', async ({ page, context }) => {
await context.route('**/*', (route) => {
console.log('Intercepted:', route.request().url());
route.continue();
});
await fetch('https://example.com');
await context.request.get('https://example.com');
await context.request.fetch('https://example.com');
await page.request.get('https://example.com');
await page.goto('https://example.com'); // Only this one gets intercepted
});
I need to send some other request to the server, outside of regular navigation, but these need to be intercepted. How can I do this?