Skip to main content

HitTest

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.

HitTest​

func (d *Device) HitTest(ctx context.Context, target string) (HitTestResult, error)

HitTest asks UIKit's own hit test, below accessibility, whether a tap on target would reach it. It returns an error 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, err := dev.HitTest(ctx, "testid=submit")
if err != nil {
return err
}
fmt.Println(hit.Reaches)