Skip to main content

Constructor

from gptdriver_client import GptDriver

gptd = GptDriver(
    api_key="YOUR_API_KEY",
    platform="android",
    device_name="Pixel 7",
    platform_version="15.0",
)
ParameterTypeDescription
api_keystrYour GPT Driver API key
platformstr"android" or "ios" (when the SDK starts its own session)
device_namestrDevice name (when the SDK starts its own session)
platform_versionstrPlatform version (when the SDK starts its own session)
driverWebDriverAn existing Appium driver to attach to instead of starting a new session
enable_self_healingboolEnable/disable self healing globally (default: True)

Self healing

By default, all find_element calls are wrapped with self-healing. When an element can’t be found, the SDK attempts to resolve it automatically.
# Self healing is automatic for all find_element calls
el = gptd.find_element(By.ID, "login-button")
Disable it globally via the constructor when you need strict assertions:
gptd = GptDriver(api_key="...", enable_self_healing=False)
See self healing for details.

AI commands

execute

Execute a natural language instruction on the current screen.
gptd.execute("Tap the login button and wait for the home screen")

assert_condition

Verify a condition without taking any action. Raises an error if the condition fails.
gptd.assert_condition("The home screen is displayed with a welcome message")

Session status

Report the outcome of a session so it is recorded on the dashboard.
gptd.set_session_status("success")  # or "failed"

Caching

The SDK supports caching to reduce AI calls for repetitive executions:
ModeDescription
NONENo caching
FULL_SCREENCache hit only if the full screen matches a previous successful execution
INTERACTION_REGIONCache hit if the interaction region matches (e.g., the area around a tapped element)