Description
Version
1.43.1
Steps to reproduce
prepare environment:
npm install [email protected]
npx playwright install firefox
and then run this script
const { firefox } = require("playwright");
(async () => {
const browser = await firefox.launch({ headless: false });
const page = await browser.newPage();
const mainUrl = "https://ridersbylee.com.au/product/r5-baggy-relaxed-jean/R_501558_DC5.html";
page.on("request", (req) => {
if (req.url() === mainUrl) {
console.log("sending request for the main URL");
}
});
page.on("response", (res) => {
if (res.url() === mainUrl) {
console.log(`got response for the main URL, status: ${res.status()}`);
}
});
await page.goto(mainUrl);
await page.waitForSelector("h1");
await browser.close();
})();
Expected behavior
Expect to see log prints for two requests/responses:
sending request for the main URL
got response for the main URL, status: 429
sending request for the main URL
got response for the main URL, status: 200
Actual behavior
Only logs for the first request/response:
Expect to see logs for two requests/responses:
sending request for the main URL
got response for the main URL, status: 429
Additional context
The website returns a 429 response for the initial navigation request, with some Javascript, once the Javascript execution is finished and receives the successful response for an XHR request it sends, it reloads the page and the website returns a 200 response for the second navigation request, I can see the two requests/responses from the DevTools.
But Playwright does not catch the second request/response.
I tried to debug it with DEBUG=pw:protocol
and found the browser didn't send the Network.requestWillBeSent
message, it did send Network.responseReceived
and Network.requestFinished
messages but seems they're discarded as there is no information about the request (related code), so maybe an issue of the Firefox browser patch.
Environment
System:
OS: macOS 13.1
CPU: (8) x64 Intel(R) Core(TM) i5-8257U CPU @ 1.40GHz
Memory: 16.54 MB / 8.00 GB
Binaries:
Node: 16.17.0 - /usr/local/bin/node
Yarn: 1.22.17 - /usr/local/bin/yarn
npm: 8.15.0 - /usr/local/bin/npm
Languages:
Bash: 3.2.57 - /bin/bash
npmPackages:
playwright: ^1.43.1 => 1.43.1