Open michael-yelnikov opened 2 days ago
Investigation note. I can repro it with the following snippet and the route above.
await page.goto('https://playwright.dev/');
await page.waitForTimeout(3000);
await page.goto('https://playwright.dev/');
Reload is not going to get into the route. Here is the requestWillBeSent I get for reload. It has "isIntercepted": false.
{
"method": "Network.requestWillBeSent",
"params": {
"url": "https://playwright.dev/",
"frameId": "mainframe-8",
"isIntercepted": false,
"requestId": "75",
"headers": [
{
"name": "Host",
"value": "playwright.dev"
},
{
"name": "User-Agent",
"value": "Mozilla/5.0 (X11; Linux x86_64; rv:132.0) Gecko/20100101 Firefox/132.0"
},
{
"name": "Accept",
"value": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
},
{
"name": "Accept-Language",
"value": "en-US"
},
{
"name": "Accept-Encoding",
"value": "gzip, deflate, br, zstd"
},
{
"name": "Connection",
"value": "keep-alive"
},
{
"name": "Upgrade-Insecure-Requests",
"value": "1"
},
{
"name": "Sec-Fetch-Dest",
"value": "document"
},
{
"name": "Sec-Fetch-Mode",
"value": "navigate"
},
{
"name": "Sec-Fetch-Site",
"value": "same-origin"
}
],
"method": "GET",
"navigationId": "nav-93",
"cause": "TYPE_DOCUMENT",
"internalCause": "TYPE_DOCUMENT"
},
"sessionId": "67eab82b-069e-42f3-9011-cffeb8552594"
}
As a temporary workaround you can use this:
test.use({ serviceWorkers: 'block' });
Looks like if the page has a chance to register the service worker, network request is not intercepted on FF.
Version
1.48.2
Steps to reproduce
Expected behavior
Chromium:
Actual behavior
Works only first few times:
Additional context
When the tests are not very fast, it always works only once. The same thing will happen if after each
await page.reload()
you set a timeout of at least one second.Environment