check page is closed or not before inputing user info

This commit is contained in:
2022-09-12 11:59:49 +02:00
parent fb69de40d0
commit 2076154da7
+2
View File
@@ -124,11 +124,13 @@ class CommandorPage {
async inputName(page) { async inputName(page) {
await page.locator(LAST_NAME).focus() await page.locator(LAST_NAME).focus()
await delay(getRandomWaitTime()) await delay(getRandomWaitTime())
if (!page.isClosed()) {
await page.locator(LAST_NAME).fill(this.contact.lastName) await page.locator(LAST_NAME).fill(this.contact.lastName)
await page.locator(FIRST_NAME).focus() await page.locator(FIRST_NAME).focus()
await delay(getRandomWaitTime()) await delay(getRandomWaitTime())
await page.locator(FIRST_NAME).fill(this.contact.firstName) await page.locator(FIRST_NAME).fill(this.contact.firstName)
} }
}
async inputPassportId(page) { async inputPassportId(page) {
await page.locator(PASSPORT_ID).focus() await page.locator(PASSPORT_ID).focus()