foxr
foxr copied to clipboard
browser.pages() returns same URL and title for all pages
const browser = await foxr.connect()
const pages = await browser.pages()
the pages const returns the following, instead of details of each page
[{"_events":{},"_eventsCount":0,"_browser":{"_events":{"disconnected"
:[null,null,null,null,null]},"_eventsCount":1},"_id":"50"},{"_events":{},"_eventsCount":0,"_browser
":{"_events":{"disconnected":[null,null,null,null,null]},"_eventsCount":1},"_id":"52"},{"_events":{
},"_eventsCount":0,"_browser":{"_events":{"disconnected":[null,null,null,null,null]},"_eventsCount"
:1},"_id":"54"},{"_events":{},"_eventsCount":0,"_browser":{"_events":{"disconnected":[null,null,nul
l,null,null]},"_eventsCount":1},"_id":"56"}]
Is this intentional or is something happening that I'm not aware of?
Thanks
that's how pages looks like when you print it to console, actually it's an array of pages that should work as intended, just like in Puppeteer.
hmm, but when I did page.title(), that was blank too for all of them :/
edit: Ah nvm, that's also an async function. Thanks for this library! Very useful!
@deepsweet Okay slightly different issue but:
const pages = await browser.pages()
log.info(`Found ${pages.length} pages`)
log.info((await pages[0].title()))
log.info((await pages[1].title()))
when I do this (where log.info is just a logging line), it prints the same title for all pages, and same url. Even though they're different tabs with different URLs
sounds like an interesting bug, I'll take a look early next week. thanks!
Yeah so the reason for this is that it doesn't look like Selenium has any capability of getting content or title for all window handles. Only able to get that from the active one.
So it's basically
for (page of pages) {
await page.bringToFront()
await page.title() // and now the title will be correct
}
Would be nice if foxr can do this by itself though
I can confirm @AfzalivE's described behavior