Java - basic test with self healing
import io.mobileboost.gptdriver.*;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.android.options.UiAutomator2Options;
public class LoginTest {
public static void main(String[] args) throws Exception {
UiAutomator2Options options = new UiAutomator2Options();
options.setCapability("gptdriver:apiKey", "YOUR_API_KEY");
// GptDriverAndroid wraps AndroidDriver with self-healing
AndroidDriver driver = new GptDriverAndroid(
new java.net.URL("http://127.0.0.1:4723"),
options
);
// These findElement calls are self-healing -
// if an element ID changes, the SDK finds the right one
driver.findElement(By.id("login-email")).sendKeys("test@example.com");
driver.findElement(By.id("login-password")).sendKeys("password123");
driver.findElement(By.id("login-button")).click();
// Use AI for complex assertions
driver.aiAssert("The home screen is displayed with a welcome message");
driver.quit();
}
}
Java - AI commands for non-native elements
GptDriverAndroid driver = new GptDriverAndroid(
new java.net.URL("http://127.0.0.1:4723"),
options,
"When asked about Location Permissions, grant it."
);
// AI handles web views and third-party components
driver.aiExecute("Tap the 'Accept cookies' button in the web view");
driver.aiExecute("Scroll down and tap on 'View pricing'");
// Extract data from the screen
Map<String, String> data = driver.aiExtract("plan name", "monthly price");
// Strict check without self healing
GptDriverAndroid gptDriver = (GptDriverAndroid) driver;
WebElement el = gptDriver.findElement(By.id("success-banner"), false);
Assert.assertTrue(el.isDisplayed());
Python - basic test
from gptdriver_client import GptDriver
gptd = GptDriver(
api_key="YOUR_API_KEY",
platform="android",
device_name="Pixel 7",
platform_version="15.0",
)
gptd.execute("Tap on the Gmail app")
gptd.assert_condition("The Gmail app is open")
gptd.set_session_status("success")
Python - with existing Appium driver
from gptdriver_client import GptDriver
from appium import webdriver
from appium.options.android import UiAutomator2Options
options = UiAutomator2Options()
options.load_capabilities({
"platformName": "Android",
"platformVersion": "14.0",
"deviceName": "emulator-5556",
"automationName": "UiAutomator2",
})
driver = webdriver.Remote(
command_executor="http://127.0.0.1:4723",
options=options
)
gptd = GptDriver(
api_key="YOUR_API_KEY",
driver=driver
)
gptd.execute("Tap on the Gmail app")
gptd.assert_condition("The Gmail app is open")
gptd.set_session_status("success")
Python - PyTest
# conftest.py
import pytest
from gptdriver_client import GptDriver
@pytest.fixture
def gptd():
driver = GptDriver(
api_key="YOUR_API_KEY",
platform="android",
device_name="Pixel 7",
platform_version="15.0",
)
yield driver
driver.set_session_status("success")
# test_example.py
def test_login(gptd):
gptd.execute("Tap the login button")
gptd.execute("Enter 'test@example.com' in the email field")
gptd.execute("Enter 'password123' in the password field")
gptd.execute("Tap Sign In")
gptd.assert_condition("The home screen is displayed")
TypeScript - CLI workflow
# Initialize the project
mobileboost init
# Launch the studio to record and edit tests
mobileboost studio
# Run all tests locally
mobileboost run --env local
# Run specific tests in the cloud
mobileboost run login-flow checkout-flow --env cloud

