pub struct Frame { /* private fields */ }Expand description
A frame within a page.
Frames are separate browsing contexts, typically created by <iframe> elements.
Each frame has its own DOM and JavaScript execution context.
Implementations§
Source§impl Frame
impl Frame
Sourcepub fn parent_id(&self) -> Option<&str>
pub fn parent_id(&self) -> Option<&str>
Get the parent frame ID.
Returns None for the main frame.
Sourcepub fn is_detached(&self) -> bool
pub fn is_detached(&self) -> bool
Check if the frame has been detached.
Sourcepub async fn content(&self) -> Result<String, PageError>
pub async fn content(&self) -> Result<String, PageError>
Get the frame’s HTML content.
§Errors
Returns an error if the frame is detached or the evaluation fails.
Sourcepub async fn title(&self) -> Result<String, PageError>
pub async fn title(&self) -> Result<String, PageError>
Get the frame’s document title.
§Errors
Returns an error if the frame is detached or the evaluation fails.
Sourcepub async fn goto_with_options(
&self,
url: &str,
wait_until: DocumentLoadState,
timeout: Duration,
) -> Result<(), NavigationError>
pub async fn goto_with_options( &self, url: &str, wait_until: DocumentLoadState, timeout: Duration, ) -> Result<(), NavigationError>
Navigate the frame to a URL with options.
§Errors
Returns an error if the frame is detached or navigation fails.
Sourcepub async fn set_content(&self, html: &str) -> Result<(), PageError>
pub async fn set_content(&self, html: &str) -> Result<(), PageError>
Set the frame’s HTML content.
§Errors
Returns an error if the frame is detached or setting content fails.
Sourcepub async fn wait_for_load_state(
&self,
state: DocumentLoadState,
) -> Result<(), NavigationError>
pub async fn wait_for_load_state( &self, state: DocumentLoadState, ) -> Result<(), NavigationError>
Wait for the frame to reach a specific load state.
§Errors
Returns an error if the wait times out or the frame is detached.
Sourcepub async fn wait_for_load_state_with_timeout(
&self,
state: DocumentLoadState,
timeout: Duration,
) -> Result<(), NavigationError>
pub async fn wait_for_load_state_with_timeout( &self, state: DocumentLoadState, timeout: Duration, ) -> Result<(), NavigationError>
Wait for the frame to reach a specific load state with timeout.
§Errors
Returns an error if the wait times out or the frame is detached.