Skip to main content

Control

Struct Control 

Source
pub struct Control {
    pub pid: u32,
    pub service: String,
    pub log_path: PathBuf,
    /* private fields */
}

Fields§

§pid: u32§service: String

rightkit-service name the app serves (control-xxxxxxxx).

§log_path: PathBuf

Implementations§

Source§

impl Control

Source

pub fn set_request_timeout(&mut self, t: Duration)

Source

pub fn health(&self) -> Result<Value>

Source

pub fn unlisted_app_probe(&self) -> Result<String>

Prove the allowlist: an app that is not on it is refused at hello. Returns the error code.

Source

pub fn click(&self, x: f64, y: f64, button: &str, count: u32) -> Result<()>

Source

pub fn click_with( &self, x: f64, y: f64, button: &str, count: u32, modifiers: &[&str], ) -> Result<()>

click holding modifiers ("shift", "cmd", "alt", "ctrl"). They travel on the native mouse events, so the page sees e.shiftKey etc. as real input.

Source

pub fn move_to(&self, x: f64, y: f64) -> Result<()>

Source

pub fn drag(&self, from: (f64, f64), to: (f64, f64), steps: u32) -> Result<()>

Source

pub fn wheel(&self, x: f64, y: f64, dx: f64, dy: f64) -> Result<()>

Source

pub fn key(&self, spec: &str) -> Result<()>

Source

pub fn type_text(&self, text: &str) -> Result<()>

Source

pub fn eval(&self, js: &str) -> Result<Value>

Evaluate a JS function body (return ...) in the page; returns its JSON value.

Source

pub fn dom(&self, selector: &str) -> Result<Vec<Value>>

Source

pub fn ax(&self) -> Result<Vec<Value>>

Source

pub fn screenshot_png(&self) -> Result<Vec<u8>>

Source

pub fn screenshot_to(&self, path: &Path) -> Result<()>

Source

pub fn command(&self, name: &str, args: &Value) -> Result<Value>

A typed app command registered with Control::command(name, f). The server hands the command its args string verbatim.

Source

pub fn center_of(&self, selector: &str) -> Result<(f64, f64)>

Centre of the first element matching selector, in viewport CSS px.

Source

pub fn click_selector(&self, selector: &str) -> Result<()>

Source

pub fn wait_eval(&self, js: &str, timeout: Duration) -> Result<Value>

Poll a JS function body until it returns something truthy; bounded.

Source

pub fn stop(&mut self) -> Result<StopReport>

Stop the app: kill the recorded pid tree, prove the port closed, and check we did not change the frontmost app.

Trait Implementations§

Source§

impl Drop for Control

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl Eval for Control

Source§

fn eval_js(&self, js: &str) -> Result<Value>

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> 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 = !

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

fn try_from(value: U) -> Result<T, !>

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<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