Client

To Initialize a python client for camelQA, you must pass in an API key and optional parameters. Note that parameters differ based on implementation.

// Set the bundle ID of the app you'd like to test
let app = XCUIApplication(bundleIdentifier: "com.toyopagroup.picaboo")
app.launch()

let q = QamlClient(
    apiKey: "<API_KEY>", 
    app: "<APP_INSTANCE>", 
    useAccessibilityElements: <BOOL, default = true>
)

app

This is the bundleID of the app you’d like to launch. Note you can still switch between apps by using switchToApp or openURL.

useAccessibilityElements

Tests executed in XCUITest can utilize accessibility labels. Setting this to true leverages accessibility elements. Setting this to false uses pure vision.

Actions

execute

This is the main way you interact with qaml. Give a natural language command and it will execute the command.

Optionally, you can provide a count to repeat the action a certain amount of times.

Nothing is returned. A QAMLExecException will be thrown if it is unable to execute the command.

assertCondition

This is how you tell qaml to verify something without taking any action. assert_condition takes a screenshot of the current screen and runs it through GPT-4o against your prompt and returns a pass or fail.

Android: Apps with FLAG_SECURE enabled block screenshots. If this occurs, camelQA falls back to using accessibility labels, which means visual cues are not supported. Check out this section of our prompt guide for tips on writing conditions not dependent on vision

Nothing is returned. A QAMLExecException will be thrown if the condition is not met.

waitUntil

This calls assert_condition on a loop. This is how you tell qaml to wait until an event occurs (ex. screen has completed loading).

waitUntil takes a screenshot of the current screen and runs it through GPT-4o against your prompt and returns a pass or fail until the condition is met or timeout occurs.

Android: Apps with FLAG_SECURE enabled block screenshots. If this occurs, camelQA falls back to using accessibility labels, which means visual cues are not supported. Check out this section of our prompt guide for tips on writing conditions not dependent on vision

systemPrompt

This appends information to the qaml system prompt. Use this to specify details about your app.

autoDelay

This adds a delay between each command. Use this if your app has long animations or you want to add a delay between each action. By default, this value is 0.

autoDelay is set at the client level and is synchronous, as in it only affects the code after the statement. This means you can switch this value throughout your test script. If you re-initialize the client, it is reset to zero.

Note, this is purely additive. This does not guarantee that the delay between each step will be exactly the time specified; it simply ensures that there will be a time delay before an action begins.

switchToApp

This is how to switch between apps. For iOS, use the bundleID. For Android, use the package ID.

Note: for iOS, you must switch to an app using this function in order to interact with that app.

launchApp

This is how to hard launch apps. This will kill the app and restart it. For iOS, use the bundleID. For Android, use the package ID.

openURL

This is how to open a deeplink to your app or a URL on the default web browser.

Be sure to include https:// in your URL or your custom URL scheme for deeplinking.

Note: Requires XCode 14.3 and higher and iOS 16 and higher

scroll

This is how to scroll in a specific direction or to a specific element. Directions available are up, down, left, and right.

getValue

This is how to retrieve a value from the app. This returns a string.

There are two modes you can use, screen shot and element list.

Screen shot uses vision to parse out the information you requested. This is a smarter model and capable of more complex asks. However, this is slower and does not have access to element labels or IDs.

Element list does not use vision. It is a simpler model that parses the element list to return the value you’ve requested. This is faster than screen shot mode and can access element labels and IDs.

alertHandler

This is how to handle system alerts automatically.

Note, iOS handles alerts across all applications. Android only handles the alerts of the target app.

dumpAccessibilityElements

This will dump all accessibility elements for the current screen to the console. This is used for debugging and does not perform any actions.