viewpoint_core/page/accessors.rs
1//! Page accessor methods.
2//!
3//! This module contains getter methods for accessing page properties.
4
5use std::sync::Arc;
6use viewpoint_cdp::CdpConnection;
7
8use super::Page;
9
10impl Page {
11 /// Get the target ID.
12 pub fn target_id(&self) -> &str {
13 &self.target_id
14 }
15
16 /// Get the session ID.
17 pub fn session_id(&self) -> &str {
18 &self.session_id
19 }
20
21 /// Get the main frame ID.
22 pub fn frame_id(&self) -> &str {
23 &self.frame_id
24 }
25
26 /// Get the context index.
27 ///
28 /// This is used for generating scoped element refs in the format
29 /// `c{contextIndex}p{pageIndex}e{counter}`.
30 pub fn context_index(&self) -> usize {
31 self.context_index
32 }
33
34 /// Get the page index.
35 ///
36 /// This is used for generating scoped element refs in the format
37 /// `c{contextIndex}p{pageIndex}e{counter}`.
38 pub fn index(&self) -> usize {
39 self.page_index
40 }
41
42 /// Get a reference to the CDP connection.
43 pub fn connection(&self) -> &Arc<CdpConnection> {
44 &self.connection
45 }
46}