fix: re-apply download behavior on recording context (#1019)
* fix: re-apply download behavior on recording context record start creates a new browser context via Target.createBrowserContext. Browser.setDownloadBehavior called at launch only applies to the default context, so downloads in the recording context are silently dropped. Fix: 1. Store download_path on BrowserManager (from LaunchOptions) 2. After creating the recording context, call Browser.setDownloadBehavior with the new browserContextId This ensures downloads work during recording. Fixes #1018 * fix: add download_path to third BrowserManager constructor (auto_connect_cdp)
This commit is contained in:
@@ -189,6 +189,8 @@ pub struct BrowserManager {
|
||||
pages: Vec<PageInfo>,
|
||||
active_page_index: usize,
|
||||
default_timeout_ms: u64,
|
||||
/// Stored download path from launch options, re-applied to new contexts (e.g., recording)
|
||||
pub download_path: Option<String>,
|
||||
}
|
||||
|
||||
const LIGHTPANDA_CDP_CONNECT_TIMEOUT: Duration = Duration::from_secs(5);
|
||||
@@ -257,6 +259,7 @@ impl BrowserManager {
|
||||
pages: Vec::new(),
|
||||
active_page_index: 0,
|
||||
default_timeout_ms: 25_000,
|
||||
download_path: download_path.clone(),
|
||||
};
|
||||
manager.discover_and_attach_targets().await?;
|
||||
manager
|
||||
@@ -321,6 +324,7 @@ impl BrowserManager {
|
||||
pages: Vec::new(),
|
||||
active_page_index: 0,
|
||||
default_timeout_ms: 10_000,
|
||||
download_path: None, // CDP connections don't have a launch-time download path
|
||||
};
|
||||
|
||||
manager.discover_and_attach_targets().await?;
|
||||
@@ -1252,6 +1256,7 @@ async fn initialize_lightpanda_manager(
|
||||
pages: Vec::new(),
|
||||
active_page_index: 0,
|
||||
default_timeout_ms: 25_000,
|
||||
download_path: None,
|
||||
};
|
||||
|
||||
match discover_and_attach_lightpanda_targets(&mut manager, deadline).await {
|
||||
|
||||
Reference in New Issue
Block a user