pub struct NavigationWaiter { /* private fields */ }Expand description
Waiter that detects and waits for navigation triggered by actions.
§Usage
- Create a waiter before performing an action
- Perform the action (click, press, etc.)
- Call
wait_for_navigation_if_triggeredto wait if navigation occurred
§Example (internal use)
let waiter = NavigationWaiter::new(event_rx, session_id, frame_id);
// ... perform action ...
waiter.wait_for_navigation_if_triggered().await?;Implementations§
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 navigation waiter.
§Arguments
event_rx- CDP event receiversession_id- Session ID to filter events forframe_id- Main frame ID to track navigation for
Sourcepub fn timeout(self, timeout: Duration) -> Self
pub fn timeout(self, timeout: Duration) -> Self
Set the navigation timeout.
This is the maximum time to wait for navigation to complete after it has been detected. Default is 30 seconds.
Wait for navigation to complete if one was triggered by the action.
This method:
- Waits up to 50ms for a navigation event to be triggered
- If navigation is detected, waits for the load state to reach
Load - If no navigation is detected, returns immediately
§Errors
Returns an error if:
- Navigation times out
- Page is closed during navigation
Trait Implementations§
Auto Trait Implementations§
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