Skip to main content

hit_test

This tool on every surface: CLI · MCP · Python · JavaScript · Go · Java · .NET

Ask the platform's own hit test, below accessibility, whether a touch at the point app_tap would use reaches the target — and if not, what it would reach. These call app_hit_test.

hit_test​

def hit_test(target: str) -> dict

Ask UIKit's own hit test, below accessibility, whether a tap on target would reach it. Raises when the touch would go elsewhere, naming what would take it and whether accessibility can see it. iOS only, and opt-in: it attaches lldb to the app, about two seconds on a simulator and nine on an iPhone, where the app must be a development build.

Examples​

Ask where a tap on an element would really land​

hit = device.hit_test("testid=submit")
print(hit["reaches"])