You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
const{ firefox }=require("playwright");(async()=>{constbrowser=awaitfirefox.launch({headless: false});constpage=awaitbrowser.newPage();constmainUrl="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()}`);}});awaitpage.goto(mainUrl);awaitpage.waitForSelector("h1");awaitbrowser.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.
The text was updated successfully, but these errors were encountered:
peonone
changed the title
[Bug]: Playwright Firefox does not catch all responses
[Bug]: Playwright Firefox does not catch all requests / responses
Apr 26, 2024
Version
1.43.1
Steps to reproduce
prepare environment:
and then run this script
Expected behavior
Expect to see log prints for two requests/responses:
Actual behavior
Only logs for the first request/response:
Expect to see logs for two requests/responses:
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 theNetwork.requestWillBeSent
message, it did sendNetwork.responseReceived
andNetwork.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
The text was updated successfully, but these errors were encountered: