Rayrun
โ† Back to Discord Forum

Downloading - CreateReadStream not working

patrickdoeringposted in #help-playwright
Open in Discord
patrickdoering
patrickdoering

Hey ๐Ÿ‘‹ , I need your help with the download. I click on an element. In the background will be executed a POST-Request to an endpoint which generates a XML-File. Then the download starts. I wanna validate the XML-File. My assumption was to do it like that:

page.on('download', (download) => download.createReadStream().then(console.log));

But it is not working. I get the attached message in my VS-Code. Any ideas what is wrong or how to fix that?

Bildschirmfoto_2023-11-30_um_13.27.38.png

This thread is trying to answer question "How can I download and validate an XML file triggered by a POST request in Chromium?"

1 reply
patrickdoering
patrickdoering

This is working on Firefox. But not in Chromium.

const [download] = await Promise.all([
    page.waitForEvent('download'),
    page.click(SearchScreen.XML_ERSTMELDUNG),
]);

await download.saveAs(download.suggestedFilename());

Related Discord Threads

TwitterGitHubLinkedIn
AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email [email protected].