Work on existing pages
I would like to work on already opened pages rather than using await browser.newPage every time. Especially useful when testing astral from deno jupyter notebooks, since those are sometimes subjected to crashes.
This sounds like it might be similar to what's happening in #86
It seems to be that the default behavior is to open a new window when starting a session
@lino-levan , I came up with a solution for that. I would like to implement two new methods on the "browser" class.
browser.listAllPages() that returns the content of http://localhost:9222/json
browser.importExistingPage(page obj or websocket url) that checks if the page already exists amongst browser.pages[] or otherwise starts a new websocket link
If you like the idea, I can come up with a PR
I'd be curious to look at precedent. How do puppeteer/playwright deal with this? Not against it though.
The correct approach is to auto-import all pages on browser boot – I think – it's at least a better default than what we have now. This will still lose pages if you have parallel connections opening and closing pages though. I'll wait until someone complains about that with a solid motivating usecase.