> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mobileboost.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Reference

> API reference for the MobileBoost XCUI SDK

## GptDriver

### Constructor

```swift theme={null}
GptDriver(
    apiKey: String,
    nativeApp: XCUIApplication,
    cachingMode: CachingMode = .none,
    testId: String = "",
    additionalUserContext: String = "",
    enableSelfHealing: Bool = true
)
```

| Parameter               | Type              | Description                                                     |
| ----------------------- | ----------------- | --------------------------------------------------------------- |
| `apiKey`                | `String`          | Your MobileBoost API key                                        |
| `nativeApp`             | `XCUIApplication` | The app instance to test                                        |
| `cachingMode`           | `CachingMode`     | Caching strategy (`.none`, `.fullScreen`, `.interactionRegion`) |
| `testId`                | `String`          | Identifier for the test (used for caching and logging)          |
| `additionalUserContext` | `String`          | Context to guide AI behavior across all steps                   |
| `enableSelfHealing`     | `Bool`            | Enable/disable self healing globally                            |

### AI commands

#### execute

Execute a natural language instruction on the current screen.

```swift theme={null}
try gptDriver.execute("Tap on the Go to Second Screen button")
```

#### assert

Verify a condition without taking action. Throws on failure.

```swift theme={null}
try gptDriver.assert("The home screen is displayed")
```

#### extract

Extract information from the current screen.

```swift theme={null}
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.
