pub struct Control {
pub pid: u32,
pub service: String,
pub log_path: PathBuf,
/* private fields */
}Fields§
§pid: u32§service: Stringrightkit-service name the app serves (control-xxxxxxxx).
log_path: PathBufImplementations§
Source§impl Control
impl Control
pub fn set_request_timeout(&mut self, t: Duration)
pub fn health(&self) -> Result<Value>
Sourcepub fn set_viewport(&self, width: u32, height: u32) -> Result<(u32, u32)>
pub fn set_viewport(&self, width: u32, height: u32) -> Result<(u32, u32)>
Resize hidden native content without screen clamping or activation. Returns measured CSS dimensions; this effect is never automatically replayed.
Sourcepub fn unlisted_app_probe(&self) -> Result<String>
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.
pub fn click(&self, x: f64, y: f64, button: &str, count: u32) -> Result<()>
Sourcepub fn click_with(
&self,
x: f64,
y: f64,
button: &str,
count: u32,
modifiers: &[&str],
) -> Result<()>
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.
pub fn move_to(&self, x: f64, y: f64) -> Result<()>
Sourcepub fn pointer(
&self,
phase: &str,
x: f64,
y: f64,
button: &str,
modifiers: &[&str],
) -> Result<()>
pub fn pointer( &self, phase: &str, x: f64, y: f64, button: &str, modifiers: &[&str], ) -> Result<()>
One native pointer phase (down, drag, up, move) in viewport CSS
pixels. Use down/drag/up for a scrub split across requests; keep the same
button and modifiers on each phase. Hidden launches use the embedded path.
pub fn drag(&self, from: (f64, f64), to: (f64, f64), steps: u32) -> Result<()>
pub fn wheel(&self, x: f64, y: f64, dx: f64, dy: f64) -> Result<()>
pub fn key(&self, spec: &str) -> Result<()>
pub fn type_text(&self, text: &str) -> Result<()>
Sourcepub fn eval(&self, js: &str) -> Result<Value>
pub fn eval(&self, js: &str) -> Result<Value>
Evaluate a JS function body (return ...) in the page; returns its JSON value.
pub fn dom(&self, selector: &str) -> Result<Vec<Value>>
pub fn ax(&self) -> Result<Vec<Value>>
pub fn screenshot_png(&self) -> Result<Vec<u8>>
pub fn screenshot_to(&self, path: &Path) -> Result<()>
Sourcepub fn command(&self, name: &str, args: &Value) -> Result<Value>
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.
Sourcepub fn center_of(&self, selector: &str) -> Result<(f64, f64)>
pub fn center_of(&self, selector: &str) -> Result<(f64, f64)>
Centre of the first element matching selector, in viewport CSS px.
pub fn click_selector(&self, selector: &str) -> Result<()>
Sourcepub fn wait_eval(&self, js: &str, timeout: Duration) -> Result<Value>
pub fn wait_eval(&self, js: &str, timeout: Duration) -> Result<Value>
Poll a JS function body until it returns something truthy; bounded.
Sourcepub fn wait_for_text(
&self,
selector: Option<&str>,
text: &str,
timeout: Duration,
) -> Result<()>
pub fn wait_for_text( &self, selector: Option<&str>, text: &str, timeout: Duration, ) -> Result<()>
Wait until text appears in the visible text (innerText) of the first element
matching selector (None = the whole body). Polls every 100 ms until timeout.
Sourcepub fn stop(&mut self) -> Result<StopReport>
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.