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
ElementEnabled
ElementVisible
ElementHasText
ElementHasChildren
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) Optionalprocess: <name>restricts to a specific process (case-insensitive, no .exe).
Fields
title: Option<TitleMatch>ProcessRunning
True when any application window belongs to a process whose name
(without .exe) matches process (case-insensitive).
YAML: type: ProcessRunning + process: <name>.
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.
WindowWithState
True when the anchor’s window is in the given state.
DialogPresent
DialogAbsent
ForegroundIsDialog
FileExists
True when the file at path exists on disk.
path supports {output.*} substitution via apply_output.
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"
TabWithAttribute
True when the browser tab anchored to scope matches the given attribute filters.
YAML: type: TabWithAttribute + at least one of:
title:TextMatchagainst the tab’s current title.url:TextMatchagainst the tab’s current URL.scopemust name a mountedTabanchor.
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'"
AllOf
AnyOf
Not
Implementations§
Source§impl Condition
impl Condition
Sourcepub fn apply_output(
&self,
locals: &HashMap<String, String>,
output: &Output,
) -> Self
pub fn apply_output( &self, locals: &HashMap<String, String>, output: &Output, ) -> Self
Return a clone with all {output.<key>} tokens substituted in pattern strings.
pub fn scope_name(&self) -> Option<&str>
pub fn describe(&self) -> String
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<'de> Deserialize<'de> for Condition
impl<'de> Deserialize<'de> for Condition
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for Condition
impl JsonSchema for Condition
Source§fn json_schema(sg: &mut SchemaGenerator) -> Schema
fn json_schema(sg: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read more