pub struct Frame { /* private fields */ }Expand description
Frame represents a frame within a page.
Every page has a main frame, and pages can have additional child frames (iframes). Frame is where navigation, selector queries, and DOM operations actually happen.
In Playwright’s architecture, Page delegates navigation and interaction methods to Frame.
Implementations§
Source§impl Frame
impl Frame
Sourcepub fn new(
parent: Arc<dyn ChannelOwner>,
type_name: String,
guid: Arc<str>,
initializer: Value,
) -> Result<Self>
pub fn new( parent: Arc<dyn ChannelOwner>, type_name: String, guid: Arc<str>, initializer: Value, ) -> Result<Self>
Creates a new Frame from protocol initialization
This is called by the object factory when the server sends a __create__ message
for a Frame object.
Sourcepub async fn goto(
&self,
url: &str,
options: Option<GotoOptions>,
) -> Result<Option<Response>>
pub async fn goto( &self, url: &str, options: Option<GotoOptions>, ) -> Result<Option<Response>>
Navigates the frame to the specified URL.
This is the actual protocol method for navigation. Page.goto() delegates to this.
Returns None when navigating to URLs that don’t produce responses (e.g., data URLs,
about:blank). This matches Playwright’s behavior across all language bindings.
§Arguments
url- The URL to navigate tooptions- Optional navigation options (timeout, wait_until)
Sourcepub async fn title(&self) -> Result<String>
pub async fn title(&self) -> Result<String>
Returns the frame’s title.
See: https://playwright.dev/docs/api/class-frame#frame-title
Sourcepub async fn query_selector(
&self,
selector: &str,
) -> Result<Option<Arc<ElementHandle>>>
pub async fn query_selector( &self, selector: &str, ) -> Result<Option<Arc<ElementHandle>>>
Returns the first element matching the selector, or None if not found.
See: https://playwright.dev/docs/api/class-frame#frame-query-selector
Sourcepub async fn query_selector_all(
&self,
selector: &str,
) -> Result<Vec<Arc<ElementHandle>>>
pub async fn query_selector_all( &self, selector: &str, ) -> Result<Vec<Arc<ElementHandle>>>
Returns all elements matching the selector.
See: https://playwright.dev/docs/api/class-frame#frame-query-selector-all