pub struct PageEventManager { /* private fields */ }Expand description
Page event manager for handling CDP events.
Implementations§
Source§impl PageEventManager
impl PageEventManager
Sourcepub fn new(connection: Arc<CdpConnection>, session_id: String) -> Self
pub fn new(connection: Arc<CdpConnection>, session_id: String) -> Self
Create a new page event manager.
Sourcepub async fn set_dialog_handler<F, Fut>(&self, handler: F)
pub async fn set_dialog_handler<F, Fut>(&self, handler: F)
Set the dialog handler.
Sourcepub async fn remove_dialog_handler(&self)
pub async fn remove_dialog_handler(&self)
Remove the dialog handler.
Sourcepub async fn set_download_handler<F, Fut>(&self, handler: F)
pub async fn set_download_handler<F, Fut>(&self, handler: F)
Set the download handler.
Sourcepub async fn set_file_chooser_handler<F, Fut>(&self, handler: F)
pub async fn set_file_chooser_handler<F, Fut>(&self, handler: F)
Set the file chooser handler.
Sourcepub async fn set_console_handler<F, Fut>(&self, handler: F)
pub async fn set_console_handler<F, Fut>(&self, handler: F)
Set the console handler.
Sourcepub async fn remove_console_handler(&self)
pub async fn remove_console_handler(&self)
Remove the console handler.
Sourcepub async fn set_pageerror_handler<F, Fut>(&self, handler: F)
pub async fn set_pageerror_handler<F, Fut>(&self, handler: F)
Set the page error handler.
Sourcepub async fn remove_pageerror_handler(&self)
pub async fn remove_pageerror_handler(&self)
Remove the page error handler.
Sourcepub async fn set_frameattached_handler<F, Fut>(&self, handler: F)
pub async fn set_frameattached_handler<F, Fut>(&self, handler: F)
Set the frame attached handler.
Sourcepub async fn remove_frameattached_handler(&self)
pub async fn remove_frameattached_handler(&self)
Remove the frame attached handler.
Set the frame navigated handler.
Remove the frame navigated handler.
Sourcepub async fn set_framedetached_handler<F, Fut>(&self, handler: F)
pub async fn set_framedetached_handler<F, Fut>(&self, handler: F)
Set the frame detached handler.
Sourcepub async fn remove_framedetached_handler(&self)
pub async fn remove_framedetached_handler(&self)
Remove the frame detached handler.
Sourcepub async fn handle_frame_attached(&self, frame: Frame)
pub async fn handle_frame_attached(&self, frame: Frame)
Handle frame attached event externally.
Handle frame navigated event externally.
Sourcepub async fn handle_frame_detached(&self, frame: Frame)
pub async fn handle_frame_detached(&self, frame: Frame)
Handle frame detached event externally.
Sourcepub async fn set_intercept_file_chooser(
&self,
enabled: bool,
) -> Result<(), PageError>
pub async fn set_intercept_file_chooser( &self, enabled: bool, ) -> Result<(), PageError>
Set whether to intercept file chooser dialogs.
Sourcepub async fn set_download_behavior(&self, allow: bool) -> Result<(), PageError>
pub async fn set_download_behavior(&self, allow: bool) -> Result<(), PageError>
Set the download behavior.
Sourcepub async fn handle_dialog_event(
&self,
dialog_type: DialogType,
message: String,
default_prompt: Option<String>,
)
pub async fn handle_dialog_event( &self, dialog_type: DialogType, message: String, default_prompt: Option<String>, )
Handle a dialog event from CDP.
Sourcepub async fn handle_download_begin(
&self,
guid: String,
suggested_filename: String,
url: String,
)
pub async fn handle_download_begin( &self, guid: String, suggested_filename: String, url: String, )
Handle download begin event.
Sourcepub async fn handle_download_progress(&self, guid: String, state: &str)
pub async fn handle_download_progress(&self, guid: String, state: &str)
Handle download progress event.
Sourcepub async fn handle_file_chooser_event(
&self,
frame_id: String,
mode: FileChooserMode,
backend_node_id: Option<i32>,
)
pub async fn handle_file_chooser_event( &self, frame_id: String, mode: FileChooserMode, backend_node_id: Option<i32>, )
Handle file chooser event.
Sourcepub async fn wait_for_dialog(
&self,
timeout: Duration,
) -> Result<Dialog, PageError>
pub async fn wait_for_dialog( &self, timeout: Duration, ) -> Result<Dialog, PageError>
Wait for a dialog to appear.
Sourcepub async fn wait_for_download(
&self,
timeout: Duration,
) -> Result<Download, PageError>
pub async fn wait_for_download( &self, timeout: Duration, ) -> Result<Download, PageError>
Wait for a download to start.
Sourcepub async fn wait_for_file_chooser(
&self,
timeout: Duration,
) -> Result<FileChooser, PageError>
pub async fn wait_for_file_chooser( &self, timeout: Duration, ) -> Result<FileChooser, PageError>
Wait for a file chooser to open.
Sourcepub async fn wait_for_console(
&self,
timeout: Duration,
) -> Result<ConsoleMessage, PageError>
pub async fn wait_for_console( &self, timeout: Duration, ) -> Result<ConsoleMessage, PageError>
Wait for a console message.
Sourcepub async fn wait_for_pageerror(
&self,
timeout: Duration,
) -> Result<PageErrorInfo, PageError>
pub async fn wait_for_pageerror( &self, timeout: Duration, ) -> Result<PageErrorInfo, PageError>
Wait for a page error.