diff --git a/src/workers/CommandorPage.js b/src/workers/CommandorPage.js index 9f77f97..33a72db 100644 --- a/src/workers/CommandorPage.js +++ b/src/workers/CommandorPage.js @@ -757,7 +757,11 @@ class CommandorPage { let url = this.page.url(); logWithDevice("successful url is " + url, this.device) await this.push_message_to_db(publishType, url) - // this.firstStart = false; + if (this.onlyForCookies) { + await this.sendCookiesToQueue(); + this.isTerminated = true; + await this.resetBrowser() + } } async push_message_to_db(publishType, url) { @@ -926,18 +930,7 @@ class CommandorPage { } }) logWithDevice("this.page.bringToFront();", this.device) - const cookiesSet = await this.page.cookies(); - let cookiesString = "" - cookiesSet.forEach((cookie) => { - cookiesString = cookiesString + cookie.name + "=" + cookie.value + ";" - }) - console.log(cookiesString); - if (this.onlyForCookies) { - // if (this.contact.ipCountry === "DE") - this.sender.sendMessage(cookiesString, "REQUEST_DATA_DE") - this.isTerminated = true - } else - this.sender.sendMessage(cookiesString) + await this.sendCookiesToQueue(); await this.page.bringToFront(); await this.fillFields(this.page) await delay(2 * 1000); @@ -1167,6 +1160,20 @@ class CommandorPage { } + async sendCookiesToQueue() { + const cookiesSet = await this.page.cookies(); + let cookiesString = "" + cookiesSet.forEach((cookie) => { + cookiesString = cookiesString + cookie.name + "=" + cookie.value + ";" + }) + console.log(cookiesString); + if (this.onlyForCookies) { + this.sender.sendMessage(cookiesString, "REQUEST_DATA_DE") + this.isTerminated = true + } else + this.sender.sendMessage(cookiesString) + } + async handleBraveSkipBtn() { let model = this.device.model() if (model === "CPH2219") { @@ -1365,7 +1372,6 @@ class CommandorPage { } else { await this.tapForDevice(this.device, 411, 2100) } - // await this.device.shell("input tap " + 411 + " " + 2100) } await delay(2000); }