Skip to content

FindNode Query Syntax

Fresh

Queries follow JSON format with three sections: Template (TP), Basic Query (BQ), and Expanded Query (EQ).

Query Structure

javascript
device.sendAai({
  query: "TP:more",           // Template
  query: "T:Hello&&C:Button", // Basic query with AND
  action: "click"             // Action to perform
});

Multiple conditions use && (AND) or || (OR) separators.

Basic Query

An empty query returns most nodes on the screen:

javascript
var output = device.sendAai({});
// Returns: { count: 89, ids: ["80006cbe","7440","7bc2",...] }

Default template is TP:more with action getIds.

Basic Query Properties

CodePropertyExample
PPackage nameP:com.example.myapp
CClass nameC:Button
RResource IDR:button5
TText contentT:Submit
DDescriptionD:Close button
BPBoolean propertiesBP:clickable, BP:editable
ITInput typeIT:>10000
CCChild countCC:!=0, CC:>0
BIBoundsBI:[0,0][540,960]
HTHint textHT:Enter your name

Filtering Examples

javascript
// Nodes with children
device.sendAai({ query: "CC:!=0" });

// Custom inputType values
device.sendAai({ query: "IT:>10000" });

// Combined conditions
device.sendAai({ query: "CC:!=0&&IT:>10000" });

// Text matching (case-insensitive)
device.sendAai({ query: "T:ci:hello" });

// Wildcard text matching
device.sendAai({ query: "T:*REAL, \nSANTA CLARA*" });

Expanded Query Options

CodeFeatureDescription
IXIndexingSelect nth match: IX:0 (first), IX:-1 (last)
OX/OYOffsetNavigate to adjacent nodes
VGViewGroupTraverse parent/child relationships
TX/TYIntersectionDetect overlapping elements
RNReductionReduce node set
STSortingSort results

Text Input Examples

javascript
// Enter text in last editable field
device.sendAai({ query: "BP:editable&&IX:-1", action: "setText(Hello)" });

// Find field by hint text
device.sendAai({ query: "HT:Input text here", action: "setText(Hello)" });

Scrolling

javascript
// Scroll down 2 pages looking for "john" (case-insensitive), then click
device.sendAai({
  actions: ["scrollIntoView(T:ci:john, down, 2);click"]
});

Unofficial documentation. Source: sigma-rt.com