try catch

This commit is contained in:
Lei PAN
2023-05-29 13:53:03 +02:00
parent b718281551
commit 74a7f9e885
2 changed files with 22 additions and 14 deletions
+18 -13
View File
@@ -769,20 +769,25 @@ class CommandorPage {
} else {
logWithDevice("this.browser.isConnected() is " + this.browser.isConnected(), this.device)
if (this.browser.isConnected()) {
let pages = await this.browser.pages();
logWithDevice("get pages", this.device)
try {
let pages = await this.browser.pages();
logWithDevice("get pages", this.device)
pages.forEach((currentPage) => {
if (currentPage.url() === RDV_URL) {
this.page = currentPage;
}
})
logWithDevice("this.page.bringToFront();", this.device)
await this.page.bringToFront();
// this.page = pages;
// this.page.await
await this.fillFields(this.page)
await delay(2 * 1000);
} catch (e) {
console.log(e)
this.isTerminated = true
}
pages.forEach((currentPage) => {
if (currentPage.url() === RDV_URL) {
this.page = currentPage;
}
})
logWithDevice("this.page.bringToFront();", this.device)
await this.page.bringToFront();
// this.page = pages;
// this.page.await
await this.fillFields(this.page)
await delay(2 * 1000);
}
}
// if (!this.browser.isConnected()) {