Skip to main content
This guide will walk you through setting up TapKit and executing your first actions on an iPhone.

Prerequisites

Before you begin, you’ll need:
  • A TapKit account with an API key
  • Python 3.9 or later
  • The TapKit Mac app installed and running (setup guide)
  • An iPhone connected via the Mac app (phone setup)

Step 1: Install the SDK

Install the TapKit Python SDK:
pip install tapkit

Step 2: Set up your API key

You can provide your API key in two ways:
export TAPKIT_API_KEY="your-api-key"

Step 3: Connect to your phone

from tapkit import TapKitClient

# Initialize the client
client = TapKitClient()

# Get your phone (works when you have one phone connected)
phone = client.get_phone()

print(f"Connected to {phone.name}")
print(f"Screen size: {phone.width}x{phone.height}")

Step 4: Execute your first action

Let’s tap the center of the screen:
# Tap the center of the screen
phone.tap(phone.screen.center)

Step 5: Capture a screenshot

# Take a screenshot
screenshot = phone.screenshot()

# Save it to a file
with open("screen.png", "wb") as f:
    f.write(screenshot)

Complete Example

Here’s a complete script that opens Safari and navigates to a website:
from tapkit import TapKitClient
import time

# Initialize
client = TapKitClient()
phone = client.get_phone()

# Go to home screen
phone.home()
time.sleep(0.5)

# Tap on Safari icon (assumes it's on home screen)
phone.tap("Safari")
time.sleep(1)

# Tap the address bar (top of screen)
phone.tap((phone.width // 2, 80))
time.sleep(0.3)

# Type a URL
phone.type_text("example.com")

# Take a screenshot
screenshot = phone.screenshot()
with open("safari.png", "wb") as f:
    f.write(screenshot)

print("Done! Check safari.png")

Next Steps