Skip to content

[BUG] Edge does not report request payload #4037

@ethanwc

Description

@ethanwc

Hi,
I am trying to verify expected data is being sent to an api. I am able to access the response data, but not the request data. How do you grab the request payload data inside playwright? I am calling request.postDataJson() which is returning null.
I created an example to demo my issue, and I ran into the same thing for post request on google.com.

const { getEdgePath } = require("edge-paths");

(async () => {
  const browser = await chromium.launch({headless: false, devtools: true, executablePath: getEdgePath() });
  const page = await browser.newPage();
  const [loadRes] = await Promise.all([
    page.waitForRequest(req => req.url().startsWith("https://browser.events.data.msn.com/OneCollector")),
    await page.goto("https://ntp.msn.com/edge/ntp?locale=en&dsp=1&sp=Bing&query=enterprise")
  ]);

   console.log(loadRes.url());
   console.log(loadRes.postDataJSON());
  await browser.close();
})();

(async () => {
  const browser = await chromium.launch({headless: false, devtools: true, executablePath: getEdgePath() });
  const page = await browser.newPage();
  const [loadRes] = await Promise.all([
    page.waitForRequest(req => req.url().startsWith("https://play.google.com")),
    await page.goto("https://google.com")
  ]);

   console.log(loadRes.url());
   console.log(loadRes.postDataJSON());
  await browser.close();
})();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions