Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Playwright Firefox does not catch all requests / responses #30563

Open
peonone opened this issue Apr 26, 2024 · 0 comments
Open

[Bug]: Playwright Firefox does not catch all requests / responses #30563

peonone opened this issue Apr 26, 2024 · 0 comments

Comments

@peonone
Copy link

peonone commented Apr 26, 2024

Version

1.43.1

Steps to reproduce

prepare environment:

npm install playwright@1.43.1
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
@peonone peonone changed the title [Bug]: Playwright Firefox does not catch all responses [Bug]: Playwright Firefox does not catch all requests / responses Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants