mediumStudy question · answer published in Playwright interview questions, so no pointsui-automationplaywright
Checking a downloaded report
Clicking "Download CSV" starts a file download. What is the correct Playwright pattern?
const downloadPromise = page.waitForEvent('download')
await page.getByRole('button', { name: 'Download CSV' }).click()
const download = await downloadPromise
await download.saveAs('out/report.csv')Discussion 0
Join free to post in the discussion.
Related questions
- Choosing a stable locatorAutomation Test Engineer
- Waiting for an elementAutomation Test Engineer
- Headless modeAutomation Test Engineer
- A missing awaitAutomation Test Engineer
- Browsers Playwright coversAutomation Test Engineer
- Using the trace viewerAutomation Test Engineer
- Finding a button by role and nameAutomation Test Engineer
- Recording a first draft of a testAutomation Test Engineer