Skip to content

Reference

cdp_interact

Interact with React components by testID (preferred) or accessibilityLabel — press buttons, long-press, type text, scroll, or set a React Hook Form field value directly. Calls JS handlers directly (not native touch). testID matches strictly; accessibilityLabel matches in tiers (exact → trim/case-insensitive → substring) and returns an ambiguity error when >1 component matches. Prefer testID for unambiguous targeting. For native gestures (swipe, drag), use device_swipe/device_press instead. setFieldValue (GH #126 Gap A): explicit fallback when typeText fails because the field routes through a Controller — pass name + value, walks UP to the nearest FormProvider and calls its setValue. Use only when typeText returns “no handler”. Portal-root coverage (GH #126 Gap B): if your app uses react-native-actions-sheet, @gorhom/bottom-sheet, or any Modal-based portal whose fiber root is not in React DevTools’ getFiberRoots() registry, set globalThis.__RN_AGENT_EXTRA_ROOTS__ = () => [sheetRef.current, ...] in your DEV block — testID resolution will then reach inside those subtrees. See CLAUDE.md template for the canonical snippet.

NameTypeRequiredDefaultConstraintsDescription
actionunknownYes
testIDunknownNo
accessibilityLabelunknownNo
textunknownNo
roleunknownNo
placeholderunknownNoDiscovery ladder (press-only): match a TextInput by its placeholder text.
exactunknownNo
includeHiddenunknownNoDiscovery ladder: include accessibility-hidden elements (excluded by default).
scrollXnumberNoFor scroll: horizontal offset in pixels (default 0)
scrollYnumberNoFor scroll: vertical offset in pixels (default 300)
animatedbooleanNotrueFor scroll: whether to animate
nameunknownNo
valueunknownNo
shouldValidateunknownNo
shouldDirtyunknownNo
cdp_interact(action: <unknown>)