correction on the fill_field method
This commit is contained in:
@@ -164,6 +164,8 @@ class CommandorPage {
|
||||
}
|
||||
await this.acceptCookies();
|
||||
await this.clickOnlineAppointment();
|
||||
await delay(2000);
|
||||
await this.clickOnlineAppointment();
|
||||
} else {
|
||||
this.isTerminated = true;
|
||||
}
|
||||
@@ -268,6 +270,14 @@ class CommandorPage {
|
||||
if (!this.isEmailFilled) {
|
||||
await page.focus(EMAIL_ID);
|
||||
await delay(getRandomWaitTime())
|
||||
console.log("will clear email field");
|
||||
await page.evaluate(() => {
|
||||
let field = document.getElementById("#email");
|
||||
if (field) {
|
||||
field.value = ""
|
||||
}
|
||||
})
|
||||
await delay(1000);
|
||||
await page.keyboard.type(this.contact.mail);
|
||||
this.isEmailFilled = true;
|
||||
}
|
||||
@@ -282,6 +292,14 @@ class CommandorPage {
|
||||
if (this.browser.isConnected()) {
|
||||
if (!this.isPhoneInput) {
|
||||
await page.focus(PHONE_NUMBER);
|
||||
console.log("will clear phone_number field");
|
||||
await page.evaluate(() => {
|
||||
let field = document.getElementById("#phone_number");
|
||||
if (field) {
|
||||
field.value = ""
|
||||
}
|
||||
})
|
||||
await delay(1000);
|
||||
await page.keyboard.type("" + this.contact.phoneNumber);
|
||||
this.isPhoneInput = true;
|
||||
}
|
||||
@@ -301,9 +319,24 @@ class CommandorPage {
|
||||
if (!this.isNameInput) {
|
||||
await page.focus(LAST_NAME);
|
||||
await delay(getRandomWaitTime());
|
||||
console.log("will clear surname field");
|
||||
await page.evaluate(() => {
|
||||
let field = document.getElementById("#surname");
|
||||
if (field) {
|
||||
field.value = ""
|
||||
}
|
||||
})
|
||||
await delay(1000);
|
||||
await page.keyboard.type(this.contact.lastName);
|
||||
await page.focus(FIRST_NAME);
|
||||
await delay(getRandomWaitTime());
|
||||
console.log("will clear name field");
|
||||
await page.evaluate(() => {
|
||||
let field = document.getElementById("#name");
|
||||
if (field) {
|
||||
field.value = ""
|
||||
}
|
||||
})
|
||||
await page.keyboard.type(this.contact.firstName);
|
||||
this.isNameInput = true;
|
||||
}
|
||||
@@ -320,7 +353,15 @@ class CommandorPage {
|
||||
if (!this.isPasspordInput) {
|
||||
await page.focus(PASSPORT_ID);
|
||||
await delay(getRandomWaitTime());
|
||||
await page.keyboard.type(this.contact.passportNumber.toString())
|
||||
console.log("will clear passport_id field");
|
||||
await page.evaluate(() => {
|
||||
let field = document.getElementById("#passport_id");
|
||||
if (field) {
|
||||
field.value = ""
|
||||
}
|
||||
})
|
||||
await delay(1000);
|
||||
await page.keyboard.type(this.contact.passportNumber.toString());
|
||||
this.isPasspordInput = true;
|
||||
}
|
||||
}
|
||||
@@ -382,10 +423,10 @@ class CommandorPage {
|
||||
log("fillFields called for contact: " + this.contact.mail)
|
||||
log("this.isFillingFields: " + this.isFillingFields);
|
||||
if (!this.isFillingFields) {
|
||||
this.isFillingFields = true;
|
||||
if (airePlanMode) {
|
||||
await this.enableDisableAirPlanMode();
|
||||
}
|
||||
this.isFillingFields = true;
|
||||
await this.chooseStore(page);
|
||||
await this.inputName(page);
|
||||
await this.chooseCountry(page);
|
||||
@@ -627,7 +668,7 @@ class CommandorPage {
|
||||
this.isCountryChoosen = false;
|
||||
this.isPhoneInput = false;
|
||||
this.isPasspordInput = false;
|
||||
this.disconnectBrowser();
|
||||
// this.disconnectBrowser();
|
||||
await this.device.shell("pm clear com.android.chrome")
|
||||
await delay(1000)
|
||||
await this.device.shell("am start -n com.android.chrome/com.google.android.apps.chrome.Main")
|
||||
@@ -696,6 +737,8 @@ class CommandorPage {
|
||||
logWithDevice("PAGE_OPTIMIZATION", this.device)
|
||||
this.device.shell("input tap " + 800 + " " + 2215)
|
||||
await delay(2000);
|
||||
this.device.shell("input tap " + 800 + " " + 2215)
|
||||
await delay(1000);
|
||||
checkResult = ocrChecker.get_result();
|
||||
break
|
||||
case OCRResult.NEED_TO_CLICK_LATE_BTN:
|
||||
|
||||
Reference in New Issue
Block a user