<code>await this.page.waitForEvent('download').then(blobFile => {
blobFile.saveAs(testFolder + '/' + testCaseFileName + blobFile.suggestedFilename())
this.page.waitForTimeout(10000);
fs.readdirSync(testFolder).forEach(async file => {
if (file.includes("Summary") && file.endsWith(".xlsx")) {
filepath = await (testFolder + '/' + file);
await console.log("Summary Report generated successfully");
}
});
})
</code>
<code>await this.page.waitForEvent('download').then(blobFile => {
blobFile.saveAs(testFolder + '/' + testCaseFileName + blobFile.suggestedFilename())
this.page.waitForTimeout(10000);
fs.readdirSync(testFolder).forEach(async file => {
if (file.includes("Summary") && file.endsWith(".xlsx")) {
filepath = await (testFolder + '/' + file);
await console.log("Summary Report generated successfully");
}
});
})
</code>
await this.page.waitForEvent('download').then(blobFile => {
blobFile.saveAs(testFolder + '/' + testCaseFileName + blobFile.suggestedFilename())
this.page.waitForTimeout(10000);
fs.readdirSync(testFolder).forEach(async file => {
if (file.includes("Summary") && file.endsWith(".xlsx")) {
filepath = await (testFolder + '/' + file);
await console.log("Summary Report generated successfully");
}
});
})
This is my code, it shows the file is downloaded when I check in headed mode. However, the file is not downloaded in the designated path.
and fails at waitforEvent('download')
I tried page.on('download)
which also shows that the file is downloaded, but it is not. It gives the below error while trying to read file as file is not present
<code>TypeError: The "path" argument must be of type string or an instance of Buffer or URL. Received undefined
</code>
<code>TypeError: The "path" argument must be of type string or an instance of Buffer or URL. Received undefined
</code>
TypeError: The "path" argument must be of type string or an instance of Buffer or URL. Received undefined
I am using playwright”: “^1.44.1
New contributor
revathi jakkula is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.