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 async fn aria_snapshot(&self) -> Result<AriaSnapshot, PageError>
pub async fn aria_snapshot(&self) -> Result<AriaSnapshot, PageError>
Capture an ARIA accessibility snapshot of this frame’s document.
The snapshot represents the accessible structure of the frame’s content as it would be exposed to assistive technologies. This is useful for accessibility testing and MCP (Model Context Protocol) integrations.
§Node References
The snapshot includes node_ref on each element (format: e{backendNodeId}).
These refs can be used with Page::element_from_ref() or Page::locator_from_ref()
to interact with elements discovered in the snapshot.
§Frame Boundaries
Any iframes within this frame are marked as frame boundaries in the snapshot
with is_frame: true. Their content is NOT traversed (for security reasons).
To capture multi-frame accessibility trees, use Page::aria_snapshot_with_frames().
§Errors
Returns an error if:
- The frame is detached
- JavaScript evaluation fails
- The snapshot cannot be parsed
Source§impl Frame
impl Frame
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.
Source§impl Frame
impl Frame
Source§impl Frame
impl Frame
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 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.