restart b

This commit is contained in:
Lei PAN
2023-04-26 14:03:22 +02:00
parent 08d70516c5
commit b323e6d4aa
4 changed files with 46 additions and 21 deletions
+9
View File
@@ -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
+2 -2
View File
@@ -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
+34 -17
View File
@@ -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
+1 -2
View File
@@ -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 &