API Reference
Python library API reference
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.
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.
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.
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.
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.