[core] log page logs

This commit is contained in:
allburov committed 2024-03-27 17:09:29 +07:00
1 parent d306304195
commit b5197b6f20
1 file changed
+9
@@ -118,6 +118,15 @@ export class WhatsappSessionWebJSCore extends WhatsappSession {
this.status = WAHASessionStatus.FAILED;
this.log.error('The WhatsApp Web page has been closed');
});
if (this.isDebugEnabled()) {
this.log.debug("Logging 'console' event for web page");
this.whatsapp.pupPage.on('console', (msg) =>
this.log.debug(`WEBJS page log: ${msg.text()}`),
);
this.whatsapp.pupPage.evaluate(() =>
console.log(`url is ${location.href}`),
);
}
})
.catch((error) => {
this.status = WAHASessionStatus.FAILED;