MCPcopy Create free account
hub / github.com/NativeScript/SimDeck / query_element_payload

Function query_element_payload

packages/server/src/api/action_execution.rs:180–206  ·  view source on GitHub ↗
(
    state: AppState,
    udid: String,
    payload: AccessibilityQueryPayload,
)

Source from the content-addressed store, hash-verified

178}
179
180async fn query_element_payload(
181 state: AppState,
182 udid: String,
183 payload: AccessibilityQueryPayload,
184) -> Result<Value, AppError> {
185 let snapshot = cached_accessibility_tree_value(
186 state,
187 udid,
188 payload.source.as_deref(),
189 payload.max_depth,
190 payload.include_hidden.unwrap_or(false),
191 false,
192 )
193 .await?;
194 let matches = query_compact_elements(
195 &snapshot,
196 &payload.selector,
197 payload.limit.unwrap_or(64).clamp(1, 512),
198 );
199 Ok(json_value!({
200 "action": "query",
201 "ok": true,
202 "source": snapshot.get("source").cloned().unwrap_or(Value::Null),
203 "count": matches.len(),
204 "matches": matches,
205 }))
206}
207
208async fn wait_for_absent_element_payload(
209 state: AppState,

Callers 1

run_batch_stepFunction · 0.85

Calls 2

query_compact_elementsFunction · 0.85

Tested by

no test coverage detected