support brave version 1.65.133

This commit is contained in:
2024-05-18 20:19:06 +02:00
parent ae2ad3f630
commit 14715d6bed
3 changed files with 33 additions and 14 deletions
+27 -14
View File
@@ -220,7 +220,7 @@ class CommandorPage {
if (this.isTerminated) {
log(this.device.model() + ":request terminated, send cancel()");
try {
if (this.page !== undefined) {
if (this.page !== undefined && !this.page.isClosed()) {
await this.page.close()
}
} catch (e) {
@@ -1048,6 +1048,12 @@ class CommandorPage {
await delay(2000);
await this.checkResultWithOcr();
break;
case OCRResult.BRAVE_PUSH_NOTIFICATION:
logWithDevice("BRAVE_NOTIFICATION", this.device)
await this.handleBravePushNotification()
await delay(3000);
await this.checkResultWithOcr();
break
case OCRResult.BRAVE_NOTIFICATION:
logWithDevice("BRAVE_NOTIFICATION", this.device)
if (this.device.model() === "21091116C") {
@@ -1289,19 +1295,21 @@ class CommandorPage {
async sendCookiesToQueue() {
try {
const cookiesSet = await this.page.cookies();
let cookiesString = ""
cookiesSet.forEach((cookie) => {
cookiesString = cookiesString + cookie.name + "=" + cookie.value + ";"
})
console.log(cookiesString);
if (this.shareCookiesWithRequests) {
let pojoToSend = await this.getRequestData()
pojoToSend.cookiesStr = cookiesString
// this.sender.sendMessage(JSON.stringify(pojoToSend), REQUEST_DATA_OBJECT)
this.sender.sendMessage(JSON.stringify(pojoToSend), TEST_QUEUE)
} else {
this.sender.sendMessage(cookiesString)
if (!this.page.isClosed()) {
const cookiesSet = await this.page.cookies();
let cookiesString = ""
cookiesSet.forEach((cookie) => {
cookiesString = cookiesString + cookie.name + "=" + cookie.value + ";"
})
console.log(cookiesString);
if (this.shareCookiesWithRequests) {
let pojoToSend = await this.getRequestData()
pojoToSend.cookiesStr = cookiesString
// this.sender.sendMessage(JSON.stringify(pojoToSend), REQUEST_DATA_OBJECT)
this.sender.sendMessage(JSON.stringify(pojoToSend), TEST_QUEUE)
} else {
this.sender.sendMessage(cookiesString)
}
}
} catch (e) {
console.log(e)
@@ -1527,6 +1535,11 @@ class CommandorPage {
}
return findIp
}
async handleBravePushNotification() {
await this.tapForDevice(this.device, 100, 400)
}
}
module