diff --git a/clear_data.sh b/clear_data.sh index 58ee5ae..587fb7c 100644 --- a/clear_data.sh +++ b/clear_data.sh @@ -20,6 +20,15 @@ adb -s 5ac879a2 shell pm clear com.android.chrome adb -s 5ac879a2 shell am set-debug-app --persistent com.android.chrome adb -s 5ac879a2 shell am start -n com.android.chrome/com.google.android.apps.chrome.Main +#oppo tab +adb -s 774687ff shell pm clear com.android.chrome +adb -s 774687ff shell am set-debug-app --persistent com.android.chrome +adb -s 774687ff shell am start -n com.android.chrome/com.google.android.apps.chrome.Main + +#oneplus 6 tab +adb -s e30eb015 shell pm clear com.android.chrome +adb -s e30eb015 shell am set-debug-app --persistent com.android.chrome +adb -s e30eb015 shell am start -n com.android.chrome/com.google.android.apps.chrome.Main #xiaomi tab adb -s 835dca3e shell pm clear com.android.chrome adb -s 835dca3e shell am set-debug-app --persistent com.android.chrome diff --git a/src/appointment.js b/src/appointment.js index c7f6a68..4fbb38c 100644 --- a/src/appointment.js +++ b/src/appointment.js @@ -124,8 +124,8 @@ async function startBook(contactPojo, device, selectedStore, audioAnalyse, alert } async function startWithList(contacts, device, selectedStore, audioAnalyse, alertBeep) { - // let duplicatedList = [].concat(contacts).concat(contacts).concat(contacts) - let duplicatedList = [].concat(contacts) + let duplicatedList = [].concat(contacts).concat(contacts).concat(contacts) + // let duplicatedList = [].concat(contacts) await duplicatedList.reduce(async (promise, contactPojo) => { // This line will wait for the last async function to finish. // The first iteration uses an already resolved Promise diff --git a/src/workers/CommandorPage.js b/src/workers/CommandorPage.js index 6307c16..d99a4bb 100644 --- a/src/workers/CommandorPage.js +++ b/src/workers/CommandorPage.js @@ -118,7 +118,7 @@ class CommandorPage { log(e) } try { - await this.setUpCookies() + // await this.setUpCookies() this.page.locator(':nth-match(:text("rendezvousparis"), 1)').click() } catch (e) { log(e) @@ -296,6 +296,7 @@ class CommandorPage { } async clickValid(page) { + await this.saveCookies() await delay(getRandomWaitTime()) try { if (!this.page.isClosed()) { @@ -393,6 +394,11 @@ class CommandorPage { logWithDevice("ERR_NETWORK_CHANGED, will reload page", this.device); await delay(2000) await this.page.reload() + } else if (content.includes("CACHE_MISS")) { + logWithDevice("CACHE_MISS, will reload page", this.device); + await delay(2000) + // await this.setUpCookies() + await this.page.reload() } else if (content.includes("ERR_TIMED_OUT")) { logWithDevice("ERR_TIMED_OUT, will reload page", this.device); await delay(2000) @@ -404,6 +410,7 @@ class CommandorPage { } else { if (currentPage.url() === RDV_URL) { await this.fillFields(this.page); + await this.saveCookies() // if (this.isFillingFields) // await this.getErrors() } else { @@ -438,6 +445,27 @@ class CommandorPage { } } + async setUpCookies() { + // load cookies from file + try { + logWithDevice("will add cookies", this.device) + const fs = require('fs'); + // let cookiesFile = fs.readFileSync('vampuka_fisherleyba@aol.com.txt', 'utf8'); + let cookiesFile = fs.readFileSync(this.contact.mail + '.txt', 'utf8'); + let cookiesList = cookiesFile.split("\n") + let cookiesListToAdd = [] + cookiesList.forEach((cookie) => { + let cookieToAdd = JSON.parse(cookie) + // if (cookieToAdd.name === "datadome") { + cookiesListToAdd.push(cookieToAdd) + // } + }) + await this.context.addCookies(cookiesListToAdd) + } catch (e) { + console.log(e) + } + } + async checkAudioBtn() { let isBlocked = await this.isBlocked() if (!isBlocked) { @@ -480,6 +508,10 @@ class CommandorPage { await this.saveCookies(); await this.push_message_to_db(PublishType.SUCCESS, response.url()) } + // if (response.url().includes("geo.captcha-delivery.com/interstitial")) { + // logWithDevice("interstitial: response.status is " + response.status()) + // await this.setUpCookies() + // } } async push_message_to_queue(publishType) { @@ -562,22 +594,7 @@ class CommandorPage { this.isTerminated = true } - async setUpCookies() { - // load cookies from file - logWithDevice("will add cookies", this.device) - const fs = require('fs'); - // let cookiesFile = fs.readFileSync('vampuka_fisherleyba@aol.com.txt', 'utf8'); - let cookiesFile = fs.readFileSync('cookies.txt', 'utf8'); - let cookiesList = cookiesFile.split("\n") - let cookiesListToAdd = [] - cookiesList.forEach((cookie) => { - let cookieToAdd = JSON.parse(cookie) - // if (cookieToAdd.name === "datadome") { - cookiesListToAdd.push(cookieToAdd) - // } - }) - await this.context.addCookies(cookiesListToAdd) - } + } module.exports = CommandorPage \ No newline at end of file diff --git a/start_avds.sh b/start_avds.sh index 162d52d..ed6924d 100644 --- a/start_avds.sh +++ b/start_avds.sh @@ -1,4 +1,3 @@ -emulator -avd Pixel_2_API_30 & emulator -avd Pixel_2_API_30_1 & emulator -avd Pixel_2_API_30_2 & emulator -avd Pixel_2_API_30_3 & @@ -8,5 +7,5 @@ emulator -avd Pixel_2_API_30_6 & emulator -avd Pixel_2_API_30_7 & emulator -avd Pixel_2_API_30_8 & emulator -avd Pixel_2_API_30_9 & -#emulator -avd Pixel_2_API_30_10 & +emulator -avd Pixel_2_API_30_10 & #emulator -avd Pixel_2_API_30_11 & \ No newline at end of file