Skip to content

[BUG] Network (request/response) intercept doesn't work with location.reload(true) on Firefox #24105

Open
@barbolo

Description

@barbolo

System info

  • Playwright Version: 1.32.2
  • Operating System: macOS 13.3.1
  • Browser: Firefox
  • Other info:

Source code

const { firefox } = require('playwright');

(async () => {
  const browser = await firefox.launch();
  const page = await browser.newPage();

  page.on('request', request => console.log(`page.on("request") - ${request.url()}`))
  page.on('response', response => console.log(`page.on("response") - ${response.url()}`))
  page.on('framenavigated', frame => { console.log(`framenavigated - ${frame.url()}`) });
  page.context().on('request', (request) => console.log(`page.context.on('request') - ${request.url()}`));
  await page.route('**/*', (route, request) => {
    console.log(`page.route('**/*') - ${request.url()}`)
    route.continue();
  });

  await page.goto('https://cdn.infosimples.com/reload.html');

  // keep page reloading every 5 seconds
})();

Steps

  • Run the source code

Expected

The expected output would be something like this (interceptions work for page reload).

page.context.on('request') - https://cdn.infosimples.com/reload.html
page.on("request") - https://cdn.infosimples.com/reload.html
page.route('**/*') - https://cdn.infosimples.com/reload.html
page.on("response") - https://cdn.infosimples.com/reload.html
framenavigated - https://cdn.infosimples.com/reload.html

page.context.on('request') - https://cdn.infosimples.com/reload.html
page.on("request") - https://cdn.infosimples.com/reload.html
page.route('**/*') - https://cdn.infosimples.com/reload.html
page.on("response") - https://cdn.infosimples.com/reload.html
framenavigated - https://cdn.infosimples.com/reload.html

...

Actual

Only framenavigated event is being intercepted after the page is first loaded:

page.context.on('request') - https://cdn.infosimples.com/reload.html
page.on("request") - https://cdn.infosimples.com/reload.html
page.route('**/*') - https://cdn.infosimples.com/reload.html
page.on("response") - https://cdn.infosimples.com/reload.html
framenavigated - https://cdn.infosimples.com/reload.html
framenavigated - https://cdn.infosimples.com/reload.html
framenavigated - https://cdn.infosimples.com/reload.html
framenavigated - https://cdn.infosimples.com/reload.html
framenavigated - https://cdn.infosimples.com/reload.html
framenavigated - https://cdn.infosimples.com/reload.html
framenavigated - https://cdn.infosimples.com/reload.html
framenavigated - https://cdn.infosimples.com/reload.html
....

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions