can connect to last page

This commit is contained in:
2023-05-20 00:02:58 +02:00
parent 076a5195b7
commit d652de8cf7
+11
View File
@@ -88,6 +88,17 @@ class CommandorPage {
}
async connect_to_browser(){
this.browser = await puppeteer.connect({
browserWSEndpoint: "ws://127.0.0.1:" + this.port + "/devtools/browser",
headless: false, defaultViewport: null
})
let pages = await this.browser.pages();
this.page = pages[pages.length - 1]
let content = await this.page.content()
console.log(content)
}
async loadPage() {
// Connect to the device.
log("loadPage() called, with port:" + this.port);