use local server

This commit is contained in:
Lei PAN
2023-06-08 18:05:54 +02:00
parent 5c7ef11668
commit 577ca37c24
4 changed files with 21 additions and 13 deletions
+16 -11
View File
@@ -461,24 +461,29 @@ class CommandorPage {
await delay(getRandomWaitTime())
try {
if (!this.page.isClosed()) {
this.page.evaluate(() => {
let element = document.getElementsByClassName("btn")[0];
if (typeof element !== 'undefined')
document.getElementsByClassName("btn")[0].focus();
})
if (!this.isTerminated) {
this.page.evaluate(() => {
let element = document.getElementsByClassName("btn")[0];
if (typeof element !== 'undefined')
document.getElementsByClassName("btn")[0].focus();
})
}
await delay(getRandomWaitTime())
if (!this.page.isClosed()) {
try {
// remove debug flag
// const validElement = await page.$('.btn');
console.log("will click on valid button");
await this.page.evaluate(() => {
document.getElementsByClassName("btn")[0].click();
})
if (this.firstStart) {
this.disconnectBrowser();
await this.checkResultWithOcr();
if (!this.isTerminated) {
await this.page.evaluate(() => {
document.getElementsByClassName("btn")[0].click();
})
if (this.firstStart) {
this.disconnectBrowser();
await this.checkResultWithOcr();
}
}
} catch (e) {
log(e);
await this.checkResultWithOcr()