Skip to main content
The Revyl Python SDK is a thin wrapper around the Revyl CLI. It gives you Python methods for starting sessions and running device actions.

1. Install

pip install revyl

2. Authenticate

Use one of these options:
revyl auth login
or:
export REVYL_API_KEY="rev_..."

3. Run Your First Script

from revyl import DeviceClient

device = DeviceClient.start(platform="ios", timeout=600)

device.tap(target="Login button")
device.type_text(target="Email field", text="[email protected]")
device.type_text(target="Password field", text="secret123")
device.tap(target="Sign In")
device.screenshot(out="after-login.png")

device.stop_session()

4. Auto-cleanup with a Context Manager

from revyl import DeviceClient

with DeviceClient.start(platform="android") as device:
    device.tap(target="Get Started")
    device.swipe(target="feed list", direction="down")
    device.long_press(target="Profile photo", duration_ms=1200)
When the with block exits, the SDK stops the tracked session automatically.

Session Lifecycle Patterns

Single-session script

Use DeviceClient.start(...) and then stop explicitly:
from revyl import DeviceClient

device = DeviceClient.start(platform="ios")
try:
    print(device.info())
    device.screenshot(out="current-screen.png")
finally:
    device.stop_session()

Reusing an existing session index

If you already know the session index:
from revyl import DeviceClient

device = DeviceClient(session_index=1)
print(device.info())
device.tap(target="Settings tab")

Grounded Targets vs Raw Coordinates

Use grounded targets by default:
device.tap(target="Sign In button")
device.type_text(target="Email field", text="[email protected]")
Use coordinates only when needed:
device.tap(x=540, y=960)
device.type_text(x=540, y=400, text="hello", clear_first=False)

Common Methods

  • Session: start, start_session, stop_session, stop_all, list_sessions, use_session, info
  • Actions: tap, double_tap, long_press, type_text, swipe, drag
  • Utilities: screenshot, install_app, launch_app, doctor

Common Failure Modes and Quick Fixes

SymptomLikely CauseQuick Fix
RevylError on first commandNot authenticatedRun revyl auth login or set REVYL_API_KEY
Actions hit wrong UI elementAmbiguous target descriptionUse more visible text in target, then verify with screenshot
Session appears missingSession timed outStart a fresh session with DeviceClient.start(...)
App launch failsWrong or missing bundle IDRe-run install_app and confirm correct bundle_id

Next