How could I use the automatic retries but still assign a value when all the retries fail? #1869
-
|
Using let x = await page
.locator(cssSelector)
.textContent()
.then((str) => {
// some code here
})
.catch((err) => {
console.log("ERROR CATCHED X", err);
return [];
)That works OK, but I'm not using the automatic retries because I'm catching the error. I would like to use the automatic retries but if they all fail, return a specific value. I guess one way to do this is to use |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
|
Beta Was this translation helpful? Give feedback.
failedRequestHandleris the standard way to solve this. You can store any data torequest.userDataso you have them available in the failed handler as well.