Skip to main content

Condition

Enum Condition 

Source
pub enum Condition {
Show 21 variants ElementFound { scope: String, selector: SelectorPath, }, ElementEnabled { scope: String, selector: SelectorPath, }, ElementVisible { scope: String, selector: SelectorPath, }, ElementHasText { scope: String, selector: SelectorPath, pattern: TextMatch, }, ElementHasChildren { scope: String, selector: SelectorPath, }, WindowWithAttribute { title: Option<TitleMatch>, automation_id: Option<String>, pid: Option<u32>, process: Option<String>, }, ProcessRunning { process: String, }, WindowClosed { anchor: String, }, WindowWithState { anchor: String, state: WindowState, }, DialogPresent { scope: String, }, DialogAbsent { scope: String, }, ForegroundIsDialog { scope: String, title: Option<TitleMatch>, }, FileExists { path: String, }, Always, ExecSucceeded, EvalCondition { expr: String, }, TabWithAttribute { scope: String, title: Option<TextMatch>, url: Option<TextMatch>, }, TabWithState { scope: String, expr: String, }, AllOf { conditions: Vec<Condition>, }, AnyOf { conditions: Vec<Condition>, }, Not { condition: Box<Condition>, },
}
Expand description

Custom Deserialize via TryFrom<serde_yaml::Value> to work around the serde limitation that #[serde(tag)] + #[serde(flatten)] don’t compose in serde_yaml. We hand-roll the mapping from a YAML map to enum variants.

Variants§

§

ElementFound

Fields

§scope: String
§selector: SelectorPath
§

ElementEnabled

Fields

§scope: String
§selector: SelectorPath
§

ElementVisible

Fields

§scope: String
§selector: SelectorPath
§

ElementHasText

Fields

§scope: String
§selector: SelectorPath
§pattern: TextMatch
§

ElementHasChildren

Fields

§scope: String
§selector: SelectorPath
§

WindowWithAttribute

Any application window matches the given attribute filters. YAML: type: WindowWithAttribute + at least one of:

  • flat title fields: exact, contains, starts_with
  • automation_id: <string> (exact match on UIA AutomationId / AXIdentifier)
  • pid: <u32> (exact process ID match) Optional process: <name> restricts to a specific process (case-insensitive, no .exe).

Fields

§automation_id: Option<String>
§process: Option<String>
§

ProcessRunning

True when any application window belongs to a process whose name (without .exe) matches process (case-insensitive). YAML: type: ProcessRunning + process: <name>.

Fields

§process: String
§

WindowClosed

True when the window anchored to anchor is no longer open. If the anchor was mounted with a PID (AnchorDef::session_pid), the check is done at the process level (no window for that PID exists). Otherwise it falls back to attempting re-resolution of the anchor.

Fields

§anchor: String
§

WindowWithState

True when the anchor’s window is in the given state.

Fields

§anchor: String
§

DialogPresent

Fields

§scope: String
§

DialogAbsent

Fields

§scope: String
§

ForegroundIsDialog

Fields

§scope: String
§

FileExists

True when the file at path exists on disk. path supports {output.*} substitution via apply_output.

Fields

§path: String
§

Always

Always evaluates to true immediately. Use as expect on steps where success is guaranteed by the action itself (e.g. Capture, NoOp).

§

ExecSucceeded

True when the most recent Exec action exited with code 0. Fails (step times out) if the process exited non-zero.

§

EvalCondition

Evaluates a boolean expression against the current output, locals, and params. The expression must return a Bool (use a comparison operator). Example: "count % 10 == 0", "score >= param.threshold"

Fields

§expr: String
§

TabWithAttribute

True when the browser tab anchored to scope matches the given attribute filters. YAML: type: TabWithAttribute + at least one of:

  • title: TextMatch against the tab’s current title.
  • url: TextMatch against the tab’s current URL. scope must name a mounted Tab anchor.

Fields

§scope: String
§

TabWithState

True when the JS expression expr evaluates to a truthy value in the browser tab scope. YAML: type: TabWithState + scope (Tab anchor) + expr (JS expression string). Example: expr: "document.readyState === 'complete'"

Fields

§scope: String
§expr: String
§

AllOf

Fields

§conditions: Vec<Condition>
§

AnyOf

Fields

§conditions: Vec<Condition>
§

Not

Fields

§condition: Box<Condition>

Implementations§

Source§

impl Condition

Source

pub fn apply_output( &self, locals: &HashMap<String, String>, output: &Output, ) -> Self

Return a clone with all {output.<key>} tokens substituted in pattern strings.

Source

pub fn scope_name(&self) -> Option<&str>

Source

pub fn describe(&self) -> String

Source

pub fn evaluate<D: Desktop>( &self, dom: &mut ShadowDom<D>, desktop: &D, locals: &HashMap<String, String>, params: &HashMap<String, String>, output: &Output, ) -> Result<bool, AutomataError>

Trait Implementations§

Source§

impl Clone for Condition

Source§

fn clone(&self) -> Condition

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Condition

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Condition

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl JsonSchema for Condition

Source§

fn schema_name() -> Cow<'static, str>

The name of the generated JSON Schema. Read more
Source§

fn json_schema(sg: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
Source§

fn inline_schema() -> bool

Whether JSON Schemas generated for this type should be included directly in parent schemas, rather than being re-used where possible using the $ref keyword. Read more
Source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
Source§

impl TryFrom<Value> for Condition

Source§

type Error = String

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

fn try_from(v: Value) -> Result<Self, String>

Performs the conversion.

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,