A Python client for interacting with React Native applications via the Hermes debugger
Project description
React Native Debugger Client
A Python client for interacting with React Native applications via the Hermes debugger.
Features
- Connect to a React Native app's Hermes debugger
- Execute JavaScript code in the React Native context
- Interact with UI elements (tap, scroll, enter text)
- Get the React component tree
- Navigate between screens
- Debug utilities (toggle debug features, performance overlay)
- Widget finder utilities
Installation
pip install react-native-debugger-client
Usage
Basic Usage
from react_native_debugger_client import ReactNativeDebuggerClient
# Connect to a React Native app running on your device or emulator
client = ReactNativeDebuggerClient(device_ip="localhost", metro_port=8081)
success, message = client.connect()
if success:
# Get the UI tree
ui_tree = client.get_ui_tree()
# Tap a button
client.tap_element(test_id="submit_button")
# Enter text in an input field
client.enter_text(test_id="email_input", text="user@example.com")
# Scroll down
client.scroll("down")
# Navigate to a screen
client.navigate_to_screen("HomeScreen")
# Execute custom JavaScript
client.execute_js("console.log('Hello from Python!');")
# Close the connection when done
client.close()
Context Manager
You can also use the client as a context manager:
with ReactNativeDebuggerClient() as client:
success, message = client.connect()
if success:
client.tap_element(text="Login")
API Reference
Connection
__init__(device_ip="localhost", metro_port=8081)- Initialize the clientconnect(timeout=10)- Connect to the React Native app's Hermes debuggerclose()- Close the connection
UI Interaction
tap_element(test_id=None, text=None, timeout=5)- Tap an element by test ID or text contententer_text(test_id, text, timeout=5)- Enter text into a TextInput elementscroll(direction="down", distance=300, timeout=5)- Scroll the screenscroll_element(test_id=None, direction="down", distance=300, timeout=5)- Scroll a specific element
Navigation
get_current_screen(timeout=5)- Get the name of the current screennavigate_to_screen(screen_name, params=None, timeout=5)- Navigate to a specific screen
Widget Utilities
find_widgets(search_by="all", search_value="", timeout=5)- Find widgets matching criteriatap_widget_by_key(key_value, timeout=5)- Tap a widget by its keytap_widget_by_text(text, timeout=5)- Tap a widget by its text contenttap_widget_by_type(widget_type, timeout=5)- Tap a widget by its typetap_widget_by_tooltip(tooltip_text, timeout=5)- Tap a widget by its tooltip textenter_text_by_key(key_value, text, timeout=5)- Enter text in a widget by its keyenter_text_by_type(widget_type, text, timeout=5)- Enter text in a widget by its typeenter_text_by_text(widget_text, text, timeout=5)- Enter text in a widget by its text content
Debug Utilities
toggle_debug_paint_feature(enable=True, timeout=5)- Toggle debug paint featuretoggle_performance_overlay(enable=True, timeout=5)- Toggle performance overlaytoggle_repaint_rainbow(enable=True, timeout=5)- Toggle repaint rainbowtoggle_debug_banner(enable=True, timeout=5)- Toggle debug banner
Requirements
- Python 3.7+
- requests>=2.28.0
- websocket-client>=1.3.0
License
MIT
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file react_native_debugger_client-0.0.1.dev1.tar.gz.
File metadata
- Download URL: react_native_debugger_client-0.0.1.dev1.tar.gz
- Upload date:
- Size: 17.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
49253700b8866a0b648e846f12020ea629c394bc7ed5b8f88e92a694335c1e13
|
|
| MD5 |
1652a5f2c0bd93bbcaaca4347a91b7c1
|
|
| BLAKE2b-256 |
fc41d24242aa5ad76022fe46a743f9dc781fbb9784908fa3b7234969b6a33857
|
File details
Details for the file react_native_debugger_client-0.0.1.dev1-py3-none-any.whl.
File metadata
- Download URL: react_native_debugger_client-0.0.1.dev1-py3-none-any.whl
- Upload date:
- Size: 19.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
02f4f06fc8c2ca62196982ee944920b1ddaa99e3437409252b5daadf2ec65c16
|
|
| MD5 |
f2c1035ca62a684bd6bad3bcd52a08a6
|
|
| BLAKE2b-256 |
13ad5a5f4b74fbf6bfa164db3c3333fe070c78db5e4409619b7808cdbcdbd2cf
|