Expand description
Common helper functions for robot tests
These helpers work with cranpose::SemanticElement to find and interact
with UI elements during robot testing.
Structs§
- Screenshot
Difference Stats - Screenshot
Pixel Difference - Scroll
Config - Configuration for scroll-into-view helpers so we don’t need too many arguments.
Enums§
Functions§
- bounds_
span - capture_
screenshot - Capture a full screenshot from the running robot app.
- changed_
pixel_ count - Count pixels that differ between two screenshots by more than
channel_thresholdon any RGBA channel. - changed_
pixel_ count_ in_ region - Count pixels that differ within a sub-region (x, y, w, h) of two screenshots.
- collect_
by_ text_ exact - collect_
tab_ bounds - collect_
text_ prefix_ counts - count_
text_ in_ tree - crop_
screenshot - Crops a rectangular region from a screenshot.
- crop_
screenshot_ logical - detect_
tab_ axis - exit_
with_ timeout - find_
bounds_ by_ text - find_
button - Find a clickable element (button) containing the specified text.
- find_
button_ center - Find a clickable element (button) containing the specified text. Returns center coordinates (x, y).
- find_
button_ exact_ in_ semantics - Find button by exact text in semantics tree.
- find_
button_ in_ semantics - Find button by text in semantics tree. Convenience wrapper around find_in_semantics + find_button.
- find_
by_ text_ recursive - Recursively search for text in semantic elements. Returns the element containing the text.
- find_
center_ by_ text - find_
clickables_ in_ range - Find all clickable elements in a specific Y range. Returns a list of (label, x, y) tuples sorted by x position.
- find_
element_ by_ text_ exact - find_
in_ semantics - Search the semantic tree from Robot, applying a finder function.
- find_
in_ subtree_ by_ text - find_
text - Find an element by text content (partial match), returning bounds (x, y, width, height).
- find_
text_ by_ prefix - Find an element whose text starts with the given prefix. Returns bounds (x, y, width, height) and the full text.
- find_
text_ by_ prefix_ in_ semantics - Find element by text prefix in semantics tree. Returns bounds (x, y, width, height) and the full text content. Useful for parsing dynamic text like “Stats: C=5 E=3 D=2”.
- find_
text_ center - Find an element by text content, returning center coordinates (x, y).
- find_
text_ exact - Find an element by exact text content, returning bounds (x, y, width, height).
- find_
text_ in_ semantics - Find element by text in semantics tree (Robot wrapper).
- has_
text - Check if an element or any of its children contains the specified text.
- logical_
region_ to_ pixel_ bounds - normalize_
screenshot_ region - Normalize a floating-point screenshot region into a stable pixel grid with bilinear sampling.
- parse_
slider_ value - Parse “label: value” text from a slider label, returning the numeric value.
- print_
semantics_ with_ bounds - root_
bounds - sample_
screenshot_ pixel_ logical - screenshot_
difference_ stats - Count differing pixels and report the strongest difference between two screenshots of equal dimensions. The difference metric is the maximum per-channel absolute difference.
- screenshot_
logical_ size - screenshot_
pixel - Returns pixel RGBA at
(x, y)from a screenshot. - scroll_
down - Scroll down by dragging from
from_ytoto_yatcenter_x. - scroll_
prefix_ into_ view - Scroll until a semantics node with the given
prefixtext is visible. Returns bounds + full text(x, y, w, h, text). - scroll_
text_ into_ view - Scroll until a semantics node with exactly matching text is visible.
Returns bounds
(x, y, w, h). - scroll_
up - Scroll up by dragging from
from_ytoto_yatcenter_x. - set_
slider_ fraction - Set a slider to a given fraction [0, 1] and return the parsed value.
- union_
bounds - visible_
bounds_ in_ viewport - y_
is_ visible - Check whether a given Y coordinate falls within the visible viewport (with 28px margin top and bottom).