Skip to main content

OneShotSession

Struct OneShotSession 

Source
pub struct OneShotSession { /* private fields */ }
Expand description

Headless Chrome session owned by a single CLI invocation (or one run script).

Implementations§

Source§

impl OneShotSession

Source

pub async fn launch_headless() -> Result<Self, CliError>

Launch local Chrome only (no connect, no daemon).

Source

pub async fn launch_headless_with_capture( capture: CaptureOpts, ) -> Result<Self, CliError>

Source

pub async fn launch_with_extensions( capture: CaptureOpts, extensions: Vec<String>, ) -> Result<Self, CliError>

Launch with Chrome extensions loaded (--load-extension).

Source

pub fn chrome_pid(&self) -> Option<u32>

Source

pub fn capture(&self) -> CaptureOpts

Source

pub fn with_capture_fields(&mut self, data: Value) -> Value

Merge console/network buffers into a result JSON when capture flags are on.

Source

pub fn drain_events(&mut self)

Drain pending CDP events into local buffers (non-blocking).

Source

pub async fn pump_events(&mut self)

Drain events and ack screencast frames (required or Chrome stops sending).

Source

pub async fn goto( &mut self, url: &str, robots: RobotsPolicy, ) -> Result<Value, CliError>

Navigate and wait for load (same process). Honors robots when policy is Honor.

Source

pub async fn scrape( &mut self, url: &str, robots: RobotsPolicy, ) -> Result<Value, CliError>

Minimal scrape: navigate, return source_url + body text + robots_policy.

Source

pub async fn view(&mut self, verbose: bool) -> Result<Value, CliError>

Accessibility tree with agent-facing @eN refs.

Source

pub async fn press( &mut self, target: &str, dblclick: bool, include_snapshot: bool, ) -> Result<Value, CliError>

Source

pub async fn write( &mut self, target: &str, value: &str, include_snapshot: bool, ) -> Result<Value, CliError>

Source

pub async fn click_at( &mut self, x: f64, y: f64, dblclick: bool, include_snapshot: bool, ) -> Result<Value, CliError>

Click at absolute page coordinates (requires experimental vision flag at CLI).

Source

pub async fn keys( &mut self, key: &str, include_snapshot: bool, ) -> Result<Value, CliError>

Source

pub async fn type_text( &mut self, target: Option<&str>, text: &str, clear: bool, submit: Option<&str>, focus_only: bool, ) -> Result<Value, CliError>

Source

pub async fn eval( &mut self, expression: &str, args_json: Option<&str>, dialog_action: Option<&str>, file_path: Option<&Path>, ) -> Result<Value, CliError>

Source

pub async fn wait_ms(&mut self, ms: u64) -> Result<Value, CliError>

Source

pub async fn grab( &mut self, path: Option<&Path>, format: &str, full_page: bool, quality: Option<i32>, element: Option<&str>, ) -> Result<Value, CliError>

Source

pub async fn extract( &mut self, target: &str, attr: Option<&str>, ) -> Result<Value, CliError>

Source

pub async fn attr( &mut self, target: &str, name: &str, ) -> Result<Value, CliError>

Source

pub async fn text(&mut self, target: &str) -> Result<Value, CliError>

PRD §7 text: extract visible text from a target.

Source

pub async fn scroll( &mut self, target: Option<&str>, delta_x: f64, delta_y: f64, ) -> Result<Value, CliError>

PRD §7 scroll: scroll window or element by delta pixels.

Source

pub async fn cookie_list( &mut self, url: Option<&str>, ) -> Result<Value, CliError>

Source

pub async fn cookie_set( &mut self, cookies_json: &str, ) -> Result<Value, CliError>

Source

pub async fn cookie_clear(&mut self) -> Result<Value, CliError>

Source

pub async fn page_info(&mut self) -> Result<Value, CliError>

Source

pub async fn assert_url( &mut self, value: &str, contains: bool, ) -> Result<Value, CliError>

Source

pub async fn assert_text( &mut self, value: &str, target: Option<&str>, ) -> Result<Value, CliError>

Source

pub async fn assert_console( &mut self, level: &str, max: u64, ) -> Result<Value, CliError>

Source

pub fn console_list( &mut self, page_idx: Option<usize>, page_size: Option<usize>, types: Option<&str>, include_preserved: bool, service_worker_id: Option<&str>, ) -> Result<Value, CliError>

Source

pub fn console_get(&mut self, id: usize) -> Result<Value, CliError>

Source

pub fn console_clear(&mut self) -> Result<Value, CliError>

Source

pub fn console_dump(&mut self, path: &Path) -> Result<Value, CliError>

Source

pub fn net_list( &mut self, page_idx: Option<usize>, page_size: Option<usize>, resource_types: Option<&str>, include_preserved: bool, ) -> Result<Value, CliError>

Source

pub fn net_get( &mut self, id: &str, request_path: Option<&Path>, response_path: Option<&Path>, ) -> Result<Value, CliError>

Resolve a network entry by 0-based index or CDP requestId string.

Source

pub async fn dialog( &mut self, accept: bool, prompt_text: Option<&str>, ) -> Result<Value, CliError>

Source

pub async fn hover( &mut self, target: &str, include_snapshot: bool, ) -> Result<Value, CliError>

Source

pub async fn drag( &mut self, from: &str, to: &str, include_snapshot: bool, ) -> Result<Value, CliError>

Source

pub async fn fill_form( &mut self, fields: &[(String, String)], include_snapshot: bool, ) -> Result<Value, CliError>

Source

pub async fn upload( &mut self, target: &str, path: &Path, include_snapshot: bool, ) -> Result<Value, CliError>

Source

pub async fn back(&mut self) -> Result<Value, CliError>

Source

pub async fn forward(&mut self) -> Result<Value, CliError>

Source

pub async fn reload(&mut self, ignore_cache: bool) -> Result<Value, CliError>

Source

pub async fn page_list(&mut self) -> Result<Value, CliError>

Source

pub async fn page_new( &mut self, url: Option<&str>, background: bool, isolated_context: bool, ) -> Result<Value, CliError>

Source

pub async fn page_select( &mut self, index: usize, bring_to_front: bool, ) -> Result<Value, CliError>

Source

pub async fn page_close( &mut self, index: Option<usize>, ) -> Result<Value, CliError>

Source

pub async fn wait_for( &mut self, ms: Option<u64>, text: Option<&str>, selector: Option<&str>, state: Option<&str>, include_snapshot: bool, ) -> Result<Value, CliError>

Source

pub async fn emulate( &mut self, user_agent: Option<&str>, locale: Option<&str>, timezone: Option<&str>, offline: bool, latitude: Option<f64>, longitude: Option<f64>, media: Option<&str>, network_conditions: Option<&str>, cpu_throttling_rate: Option<f64>, color_scheme: Option<&str>, extra_headers_json: Option<&str>, viewport: Option<&str>, ) -> Result<Value, CliError>

Source

pub async fn resize( &mut self, width: i32, height: i32, scale: f64, mobile: bool, ) -> Result<Value, CliError>

Source

pub async fn perf_start( &mut self, path: Option<&Path>, reload: bool, auto_stop: bool, ) -> Result<Value, CliError>

Source

pub async fn perf_stop( &mut self, path: Option<&Path>, ) -> Result<Value, CliError>

Source

pub async fn perf_insight( &mut self, name: Option<&str>, insight_set_id: Option<&str>, ) -> Result<Value, CliError>

Source

pub fn perf_insight_file( path: &Path, name: Option<&str>, ) -> Result<Value, CliError>

Offline insight from a previously written trace path (no browser required).

Source

pub async fn screencast_start( &mut self, path: Option<&Path>, ) -> Result<Value, CliError>

Source

pub async fn screencast_stop( &mut self, path: Option<&Path>, ) -> Result<Value, CliError>

Source

pub async fn heap_take(&mut self, path: &Path) -> Result<Value, CliError>

Source

pub fn heap_file_summary(path: &Path) -> Result<Value, CliError>

Source

pub fn heap_close(path: &Path) -> Result<Value, CliError>

Source

pub fn heap_compare(base: &Path, current: &Path) -> Result<Value, CliError>

Source

pub fn heap_details(path: &Path) -> Result<Value, CliError>

Source

pub fn heap_dup_strings(path: &Path) -> Result<Value, CliError>

Source

pub fn heap_class_nodes(path: &Path, id: u64) -> Result<Value, CliError>

Source

pub fn heap_node_op(path: &Path, node: u64, op: &str) -> Result<Value, CliError>

Source

pub fn heap_object_details(path: &Path, node: u64) -> Result<Value, CliError>

Offline object details for one node id (distance, retained size, detachedness).

Source

pub async fn extension_list(&mut self) -> Result<Value, CliError>

Source

pub async fn extension_reload(&mut self, id: &str) -> Result<Value, CliError>

Reload extension service worker target by id prefix (one-shot CDP).

Source

pub async fn extension_trigger(&mut self, id: &str) -> Result<Value, CliError>

Source

pub async fn devtools3p_list(&mut self) -> Result<Value, CliError>

Discover third-party developer tools via devtoolstooldiscovery CustomEvent.

Source

pub async fn devtools3p_exec( &mut self, name: &str, params_json: Option<&str>, ) -> Result<Value, CliError>

Source

pub async fn webmcp_list(&mut self) -> Result<Value, CliError>

List WebMCP / declarative tool forms on the page (Chrome 149+ features).

Source

pub async fn webmcp_exec( &mut self, name: &str, input_json: Option<&str>, ) -> Result<Value, CliError>

Source

pub async fn shutdown(self) -> Result<(), CliError>

Close CDP + wait/kill child (FINALIZE core).

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more