save cookies to queue message

This commit is contained in:
2024-01-05 11:06:36 +01:00
parent c1e6d2c44c
commit 2209b66580
4 changed files with 85 additions and 42 deletions
+12 -3
View File
@@ -72,13 +72,14 @@ function logWithDevice(message, device) {
}
class CommandorPage {
constructor(contact, device, mongoManager, selectedStore = DEFAULT_STORE, audioAnalyse = false, alertBeep = false, port = 9000) {
constructor(contact, device, sender, mongoManager, selectedStore = DEFAULT_STORE, audioAnalyse = false, alertBeep = false, port = 9000) {
this.contact = contact;
this.device = device;
this.mongoManager = mongoManager;
this.selectedStore = selectedStore;
this.choosedStore = selectedStore;
this.port = port;
this.sender = sender;
this.ocrChecker = new OCRChecker(this.device, this.contact);
this.browserPackageName = "com.brave.browser";
// this.browserPackageName = "com.android.chrome";
@@ -848,7 +849,7 @@ class CommandorPage {
try {
logWithDevice("get pages", this.device)
// let pages = await this.browser.pages();
// add listeners
let pages = await timeout(this.browser.pages(), 5 * 1000);
pages.forEach((currentPage) => {
if (currentPage.url() === RDV_URL) {
@@ -863,7 +864,15 @@ 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);
this.sender.sendMessage(cookiesString)
// let content = await this.page.content()
// console.log(content)
await this.page.bringToFront();
await this.fillFields(this.page)
await delay(2 * 1000);