pub struct LoadStateWaiter { /* private fields */ }Expand description
Waits for page load states by listening to CDP events.
Implementations§
Source§impl LoadStateWaiter
impl LoadStateWaiter
Sourcepub fn new(
event_rx: Receiver<CdpEvent>,
session_id: String,
frame_id: String,
) -> Self
pub fn new( event_rx: Receiver<CdpEvent>, session_id: String, frame_id: String, ) -> Self
Create a new load state waiter.
Sourcepub async fn wait_for_load_state(
&mut self,
target_state: DocumentLoadState,
) -> Result<(), WaitError>
pub async fn wait_for_load_state( &mut self, target_state: DocumentLoadState, ) -> Result<(), WaitError>
Wait for the specified load state to be reached.
§Errors
Returns an error if the wait times out or is cancelled.
Sourcepub async fn wait_for_load_state_with_timeout(
&mut self,
target_state: DocumentLoadState,
timeout_duration: Duration,
) -> Result<(), WaitError>
pub async fn wait_for_load_state_with_timeout( &mut self, target_state: DocumentLoadState, timeout_duration: Duration, ) -> Result<(), WaitError>
Wait for the specified load state with a custom timeout.
§Errors
Returns an error if the wait times out or is cancelled.
Sourcepub async fn set_commit_received(&self)
pub async fn set_commit_received(&self)
Set the current load state (used when commit is detected).
Sourcepub async fn current_state(&self) -> DocumentLoadState
pub async fn current_state(&self) -> DocumentLoadState
Get the current load state.
Sourcepub async fn response_data(&self) -> NavigationResponseData
pub async fn response_data(&self) -> NavigationResponseData
Get the captured response data from navigation.
This returns the status code, headers, and final URL captured during navigation.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LoadStateWaiter
impl !RefUnwindSafe for LoadStateWaiter
impl Send for LoadStateWaiter
impl Sync for LoadStateWaiter
impl Unpin for LoadStateWaiter
impl !UnwindSafe for LoadStateWaiter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more