Skip to main content
TapKit can type text into any active text field using two methods: simulated keystrokes or clipboard paste.

Basic Usage

Type text using simulated keystrokes:
phone.type_text("Hello, world!")

Input Methods

Keys (Default)

Simulates pressing individual keys:
phone.type_text("Hello", method="keys")
  • More realistic typing simulation
  • Works in all apps
  • Slower for long text

Paste

Uses the clipboard to paste text:
phone.type_text("Hello", method="paste")
  • Much faster for long text
  • Text appears instantly
  • May not work in all contexts

Parameters

ParameterTypeDefaultDescription
textstrrequiredText to type
methodstr"keys""keys" or "paste"

When to Use Each Method

Best for:
  • Short text inputs
  • Password fields (some block paste)
  • Apps that need realistic input timing
  • Testing keyboard behavior
phone.type_text("password123", method="keys")

Examples

Fill a Form

# Tap name field
phone.tap((phone.width // 2, 200))
time.sleep(0.2)

# Type name
phone.type_text("John Doe")
time.sleep(0.2)

# Tap email field
phone.tap((phone.width // 2, 280))
time.sleep(0.2)

# Type email
phone.type_text("[email protected]")

Enter a URL

# Open Safari and tap address bar
phone.open_app("Safari")
time.sleep(1)
phone.tap((phone.width // 2, 80))
time.sleep(0.3)

# Paste URL (faster for long URLs)
phone.type_text("https://example.com/page", method="paste")

Type a Message

# Open Messages
phone.open_app("Messages")
time.sleep(1)

# Tap compose field
phone.tap((phone.width // 2, phone.height - 50))
time.sleep(0.2)

# Type message
phone.type_text("Hey! How are you?")

# Tap send
phone.tap((phone.width - 40, phone.height - 50))

Enter Multi-line Text

# Type with newlines
phone.type_text("Line 1\nLine 2\nLine 3", method="paste")
# Open Spotlight
phone.spotlight()
time.sleep(0.3)

# Type search query
phone.type_text("Weather")
time.sleep(0.5)

# Tap first result
phone.tap((phone.width // 2, 200))

Tips

Tap the input field first and wait briefly before typing:
phone.tap((100, 200))  # Tap field
time.sleep(0.2)         # Wait for keyboard
phone.type_text("Text")
Both methods support special characters, emoji, and international text:
phone.type_text("Hello! 👋 Привет!")
To replace existing text, first select all and delete:
phone.tap_and_hold((100, 200))  # Long press to select
time.sleep(0.5)
# Tap "Select All" if available
phone.type_text("New text")  # Replaces selection

Next Steps