pub struct Control {
pub pid: u32,
pub service: String,
pub log_path: PathBuf,
/* private fields */
}Fields§
§pid: u32§service: Stringrightkit-daemon name the app serves (control-xxxxxxxx).
log_path: PathBufImplementations§
Source§impl Control
impl Control
Sourcepub fn assert_no_permission_dialog(&self) -> Result<()>
pub fn assert_no_permission_dialog(&self) -> Result<()>
Fail when a system permission dialog is known to be showing for this app. TODO: the
automation layer cannot enumerate windows by owner (UserNotificationCenter,
CoreServicesUIAgent), so this is a no-op that returns Ok today; see
crate::userdata::live_permission_dialog_check. Use
StopReport::permission_dialog for the evidence that does exist.
pub fn set_request_timeout(&mut self, t: Duration)
Sourcepub fn set_pace_ms(&mut self, ms: u64)
pub fn set_pace_ms(&mut self, ms: u64)
Gap between native input events the app inserts (default 0, no gap). Also set from
RIGHTKIT_QA_PACE_MS at launch. The former fixed pauses were about click 40-50, drag 16,
key 20, type 8 ms; use this for a page that needs real time between events.
Sourcepub fn batch(&self, steps: &[(&str, Value)]) -> Result<Vec<Value>>
pub fn batch(&self, steps: &[(&str, Value)]) -> Result<Vec<Value>>
Run steps ((method, params)) in ONE round trip, stopping at the first failure. Every step is
checked against this app’s allowlist and passes the effect gate and input lease on its own.
Returns each step’s result; the error names the failing step. A batch is never replayed.
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>
Wait until a JS function body returns something truthy; bounded. One round trip: the app
waits in the page (DOM mutations, events, a short timer) and replies the moment it holds.
An app on an older driver without the wait method is polled every 25 ms instead.
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); see wait_eval.
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.