pub struct Page { /* private fields */ }Expand description
A browser page (tab).
Implementations§
Source§impl Page
impl Page
Sourcepub fn goto(&self, url: impl Into<String>) -> GotoBuilder<'_>
pub fn goto(&self, url: impl Into<String>) -> GotoBuilder<'_>
Navigate to a URL.
Returns a builder for configuring navigation options.
§Example
use viewpoint_core::Page;
use viewpoint_core::DocumentLoadState;
use std::time::Duration;
// Simple navigation
page.goto("https://example.com").goto().await?;
// Navigation with options
page.goto("https://example.com")
.wait_until(DocumentLoadState::DomContentLoaded)
.timeout(Duration::from_secs(10))
.goto()
.await?;Sourcepub async fn goto_url(
&self,
url: &str,
) -> Result<NavigationResponse, NavigationError>
pub async fn goto_url( &self, url: &str, ) -> Result<NavigationResponse, NavigationError>
Navigate to a URL and wait for the specified load state.
This is a convenience method that calls goto(url).goto().await.
§Errors
Returns an error if:
- The page is closed
- Navigation fails
- The wait times out
Sourcepub fn session_id(&self) -> &str
pub fn session_id(&self) -> &str
Get the session ID.
Sourcepub fn connection(&self) -> &Arc<CdpConnection>
pub fn connection(&self) -> &Arc<CdpConnection>
Get a reference to the CDP connection.
Sourcepub fn get_by_text(&self, text: impl Into<String>) -> Locator<'_>
pub fn get_by_text(&self, text: impl Into<String>) -> Locator<'_>
Sourcepub fn get_by_text_exact(&self, text: impl Into<String>) -> Locator<'_>
pub fn get_by_text_exact(&self, text: impl Into<String>) -> Locator<'_>
Create a locator for elements with exact text content.
Sourcepub fn get_by_role(&self, role: AriaRole) -> RoleLocatorBuilder<'_>
pub fn get_by_role(&self, role: AriaRole) -> RoleLocatorBuilder<'_>
Sourcepub fn get_by_test_id(&self, test_id: impl Into<String>) -> Locator<'_>
pub fn get_by_test_id(&self, test_id: impl Into<String>) -> Locator<'_>
Sourcepub fn get_by_label(&self, label: impl Into<String>) -> Locator<'_>
pub fn get_by_label(&self, label: impl Into<String>) -> Locator<'_>
Trait Implementations§
Source§impl<'a> Expectable<'a> for Page
impl<'a> Expectable<'a> for Page
Source§type Assertions = PageAssertions<'a>
type Assertions = PageAssertions<'a>
The assertion builder type for this value.
Source§fn assertions(&'a self) -> Self::Assertions
fn assertions(&'a self) -> Self::Assertions
Create an assertion builder for this value.
Auto Trait Implementations§
impl Freeze for Page
impl !RefUnwindSafe for Page
impl Send for Page
impl Sync for Page
impl Unpin for Page
impl !UnwindSafe for Page
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