fix: add on load emit urlChanged

This commit is contained in:
RohitR311
2024-12-06 03:40:58 +05:30
parent 079863d015
commit 964913775e

View File

@@ -402,14 +402,14 @@ export class RemoteBrowser {
await this.currentPage?.close();
this.currentPage = newPage;
if (this.currentPage) {
this.currentPage.on('framenavigated', (frame) => {
if (frame === this.currentPage?.mainFrame()) {
this.socket.emit('urlChanged', this.currentPage.url());
}
});
// this.currentPage.on('load', (page) => {
// this.socket.emit('urlChanged', page.url());
// })
// this.currentPage.on('framenavigated', (frame) => {
// if (frame === this.currentPage?.mainFrame()) {
// this.socket.emit('urlChanged', this.currentPage.url());
// }
// });
this.currentPage.on('load', (page) => {
this.socket.emit('urlChanged', page.url());
})
this.client = await this.currentPage.context().newCDPSession(this.currentPage);
await this.subscribeToScreencast();
} else {