pub struct FrameLocator<'a> { /* private fields */ }Expand description
A locator for finding and interacting with iframe content.
FrameLocator represents a view into an iframe on the page. It provides
methods to locate elements within the iframe using the same patterns
as page-level locators.
§Example
use viewpoint_core::AriaRole;
// Locate elements inside an iframe
page.frame_locator("#my-iframe")
.locator("button")
.click()
.await.ok();
// Use semantic locators inside frames
page.frame_locator("#payment-frame")
.get_by_role(AriaRole::Button)
.with_name("Submit")
.build()
.click()
.await.ok();
// Nested frames
page.frame_locator("#outer")
.frame_locator("#inner")
.locator("input")
.fill("text")
.await.ok();Implementations§
Source§impl<'a> FrameLocator<'a>
impl<'a> FrameLocator<'a>
Sourcepub fn locator(&self, selector: impl Into<String>) -> FrameElementLocator<'a>
pub fn locator(&self, selector: impl Into<String>) -> FrameElementLocator<'a>
Create a locator for elements within this frame.
§Example
use viewpoint_core::Page;
let button = page.frame_locator("#iframe").locator("button.submit");
button.click().await?;Sourcepub fn get_by_text(&self, text: impl Into<String>) -> FrameElementLocator<'a>
pub fn get_by_text(&self, text: impl Into<String>) -> FrameElementLocator<'a>
Create a locator for elements containing the specified text within this frame.
Sourcepub fn get_by_text_exact(
&self,
text: impl Into<String>,
) -> FrameElementLocator<'a>
pub fn get_by_text_exact( &self, text: impl Into<String>, ) -> FrameElementLocator<'a>
Create a locator for elements with exact text content within this frame.
Sourcepub fn get_by_role(&self, role: AriaRole) -> FrameRoleLocatorBuilder<'a>
pub fn get_by_role(&self, role: AriaRole) -> FrameRoleLocatorBuilder<'a>
Create a locator for elements with the specified ARIA role within this frame.
Sourcepub fn get_by_test_id(
&self,
test_id: impl Into<String>,
) -> FrameElementLocator<'a>
pub fn get_by_test_id( &self, test_id: impl Into<String>, ) -> FrameElementLocator<'a>
Create a locator for elements with the specified test ID within this frame.
Sourcepub fn get_by_label(&self, label: impl Into<String>) -> FrameElementLocator<'a>
pub fn get_by_label(&self, label: impl Into<String>) -> FrameElementLocator<'a>
Create a locator for form controls by their associated label text within this frame.
Sourcepub fn get_by_placeholder(
&self,
placeholder: impl Into<String>,
) -> FrameElementLocator<'a>
pub fn get_by_placeholder( &self, placeholder: impl Into<String>, ) -> FrameElementLocator<'a>
Create a locator for inputs by their placeholder text within this frame.
Sourcepub fn frame_locator(&self, selector: impl Into<String>) -> FrameLocator<'a>
pub fn frame_locator(&self, selector: impl Into<String>) -> FrameLocator<'a>
Create a frame locator for a nested iframe within this frame.
§Example
use viewpoint_core::Page;
// Access element in nested frame
page.frame_locator("#outer-frame")
.frame_locator("#inner-frame")
.locator("button")
.click()
.await?;Sourcepub fn parent_selectors(&self) -> &[String]
pub fn parent_selectors(&self) -> &[String]
Get the parent selectors (for nested frames).
Trait Implementations§
Source§impl<'a> Clone for FrameLocator<'a>
impl<'a> Clone for FrameLocator<'a>
Source§fn clone(&self) -> FrameLocator<'a>
fn clone(&self) -> FrameLocator<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more