Is it normal to use await with then() and catch() in Puppeteer?
await page.waitForSelector('.notification-message') .then( async () => { signale.success('Form was submitted successfully'); // This is a fancy console.log() await page.screenshot({path: automated_test_success_$dateString.png}); browser.close(); }) .catch(() => signale.fatal(new Error('Submit form failed')));
automated_test_success_
.png
It is a matter of style preference, the idea is to catch important errors.
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Is it normal to use await with then() and catch() in Puppeteer?
await page.waitForSelector('.notification-message')
.then( async () => {
signale.success('Form was submitted successfully'); // This is a fancy console.log()
await page.screenshot({path:
automated_test_success_
$dateString.png
});browser.close();
})
.catch(() => signale.fatal(new Error('Submit form failed')));
It is a matter of style preference, the idea is to catch important errors.