You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I connect() to an existing Chromium instance with one or more already open tabs, calling browser.pages() returns an empty vector instead of listing the open tabs which are visible via CDP at http://localhost:9222/json.
I don't know if this is intended behaviour but it somewhat negates the usefulness of connecting to an existing instance I believe.
It can be reproduced as so:
Launch chrome with remote debugging enabled, for example:
let url = "ws://localhost:9222/devtools/browser/{some id}";
// browser/handler
let (mut browser, mut handler) = Browser::connect(url).await.unwrap();
// spawn a new task that continuously polls the handler
let handle = tokio::task::spawn(async move {
while let Some(h) = handler.next().await {
if h.is_err() {
break;
}
}
});
// list pages
let pages = browser.pages().await;
let pages = pages.unwrap_or_default();
println!("{:?}", pages);
// --> an empty vec
let page = browser.new_page("https://example.com").await;
let pages = browser.pages().await;
let pages = pages.unwrap_or_default();
println!("{:?}", pages);
// --> a vec containing the example.com page
The text was updated successfully, but these errors were encountered:
steve-the-crab
changed the title
browser.pages() does not return pages not created directly by the crate but that are visible in CDP
browser.pages() does not return pages that weren't created directly by the crate but that are visible in CDP
Apr 12, 2023
If I
connect()
to an existing Chromium instance with one or more already open tabs, callingbrowser.pages()
returns an empty vector instead of listing the open tabs which are visible via CDP athttp://localhost:9222/json
.I don't know if this is intended behaviour but it somewhat negates the usefulness of connecting to an existing instance I believe.
It can be reproduced as so:
Launch chrome with remote debugging enabled, for example:
$ google-chrome-stable --remote-debugging-port=9222
Connect and list the pages:
The text was updated successfully, but these errors were encountered: