pub struct Session { /* private fields */ }Expand description
High-level CDP session. Manages connection + tabs with event-driven lifecycle.
Implementations§
Source§impl Session
impl Session
Sourcepub async fn create_tab(&self, url: &str) -> Result<Tab>
pub async fn create_tab(&self, url: &str) -> Result<Tab>
Create a new tab/page
Sourcepub async fn evaluate(&self, tab: &Tab, js: &str) -> Result<Value>
pub async fn evaluate(&self, tab: &Tab, js: &str) -> Result<Value>
Evaluate JavaScript in a tab, return JSON result
Navigate to URL and wait for networkIdle lifecycle event
Sourcepub async fn check_page_signals(&self, tab: &Tab) -> Result<Vec<QualityFlag>>
pub async fn check_page_signals(&self, tab: &Tab) -> Result<Vec<QualityFlag>>
Runs a compact JS snippet in the page to detect quality issues before extraction.
The JS snippet checks for Cloudflare/Turnstile bot walls, reCAPTCHA/hCaptcha, and paywall text markers.
Keep JS logic in sync with Session::parse_signal_flags and gthings_extraction::quality::detection.
Sourcepub async fn wait_for<F>(
&self,
method: &str,
predicate: F,
timeout: Duration,
) -> Result<CdpEvent>
pub async fn wait_for<F>( &self, method: &str, predicate: F, timeout: Duration, ) -> Result<CdpEvent>
Wait for a CDP event matching method + predicate.
Warning: Creates a new event subscription. Subscribe BEFORE the action that
triggers the event to avoid race conditions. For navigation, use
navigate() instead.
Sourcepub async fn disconnect(self) -> Result<()>
pub async fn disconnect(self) -> Result<()>
Disconnect from browser
Sourcepub fn connection(&self) -> &Connection
pub fn connection(&self) -> &Connection
Access the underlying Connection (for direct CDP calls)