Skip to content

The headless browser for AI agents and web scraping

fix(browser): thread page callbacks through stealth do_fetch

Andrey Mnatsakanov758b3e3db178
diff --git a/crates/obscura-browser/src/page.rs b/crates/obscura-browser/src/page.rs
index 7fa2bdd8..3658ee5e 100644
--- a/crates/obscura-browser/src/page.rs
+++ b/crates/obscura-browser/src/page.rs
@@ -1594,7 +1594,12 @@ impl Page {
async fn do_fetch(&self, url: &Url) -> Result<Response, ObscuraNetError> {
#[cfg(feature = "stealth")]
if let Some(ref stealth) = self.stealth_client {
- return stealth.fetch(url).await;
+ // Pass the page callbacks so CDP Network events and
+ // page.on('request'/'response') observers fire for stealth-mode
+ // navigations too, matching the non-stealth path below.
+ return stealth
+ .fetch_with_callbacks(url, Some(&self.callbacks))
+ .await;
}
self.http_client
.fetch_with_callbacks(url, Some(&self.callbacks))