Skip to main content

GptDriver

Constructor

GptDriver(
    apiKey: String,
    nativeApp: XCUIApplication,
    cachingMode: CachingMode = .none,
    testId: String = "",
    additionalUserContext: String = "",
    enableSelfHealing: Bool = true
)
ParameterTypeDescription
apiKeyStringYour MobileBoost API key
nativeAppXCUIApplicationThe app instance to test
cachingModeCachingModeCaching strategy (.none, .fullScreen, .interactionRegion)
testIdStringIdentifier for the test (used for caching and logging)
additionalUserContextStringContext to guide AI behavior across all steps
enableSelfHealingBoolEnable/disable self healing globally

AI commands

execute

Execute a natural language instruction on the current screen.
try gptDriver.execute("Tap on the Go to Second Screen button")

assert

Verify a condition without taking action. Throws on failure.
try gptDriver.assert("The home screen is displayed")

extract

Extract information from the current screen.
let data = try gptDriver.extract("username", "account balance")

Session URL

The SDK creates a session URL for each test run, accessible via:
  • gptDriver.sessionURL: public property
  • onSessionCreated callback: for real-time access
  • XCTest Attachments: saved as a .webloc file in test results
  • OS Logs: logged at .notice level

Retrieving in CI

The session URL is saved as an XCTest attachment named GPTDriver Session URL Link with lifetime .keepAlways. Extract it from the .xcresult bundle in your CI pipeline.