Skip to main content
🚀 Self Healing AI Agent now live in App Automate! Auto-fix flaky tests instantly with zero code changes. Enable now!
No Result Found
Connect & Get help from fellow developers on our Discord community. Ask the CommunityAsk the Community

Natural language AI authoring Icon indicating AI feature

Use natural language to generate Appium test cases automatically.

AI authoring lets you write test cases in plain English instead of selectors or code. The AI interprets natural language instructions, generates the automation steps at runtime, and executes them across devices and OS.

This approach helps teams speed up test creation, reduce maintenance, and scale automation with minimal overhead.

Why use AI authoring?

AI authoring addresses common challenges faced by QA teams:

  • Cross-platform coverage: Run the same test steps on any Android and iOS devices without changes.
  • Save time: QAs spend a lot of their time writing and maintaining tests. AI reduces this by eliminating selectors and waits.
  • Reduce flaky tests: Many sessions hit locator issues. AI abstracts away locators to avoid these failures.
  • Faster execution: High-level commands such as “Add item to cart and verify total” are executed in one step instead of multiple low-level actions.

How to use AI authoring

Follow these steps to start writing and running tests using natural language authoring:

Natural language AI authoring is currently in beta. Features and supported environments may change as we continue to improve the experience.

Enable AI authoring

Contact your admin to activate BrowserStack AI for your group account to use this feature.

Add capabilities

Add the following capability to enable AI Authoring for your Appium tests

If you are using BrowserStack SDK, you can set the capabilities in the browserstack.yml file:

browserstack.yml
Copy icon Copy

You can use either Selenium 4 or Selenium Legacy JSON to organize your tests

Use the aiAuthoring capability as shown in the following code sample:

MutableCapabilities capabilities = new MutableCapabilities();
HashMap<String, Object> browserstackOptions = new HashMap<String, Object>();
browserstackOptions.put("userName", "YOUR_USERNAME");
browserstackOptions.put("accessKey", "YOUR_ACCESS_KEY");
browserstackOptions.put("aiAuthoring", "true");
capabilities.setCapability("bstack:options", browserstackOptions);
var capabilities = {
	'bstack:options' : {
		"userName" : "YOUR_USERNAME",
		"accessKey" : "YOUR_ACCESS_KEY",
		"aiAuthoring" : "true"
	}
}
Dictionary<string, object> browserstackOptions = new Dictionary<string, object>();
browserstackOptions.Add("userName", "YOUR_USERNAME");
browserstackOptions.Add("accessKey", "YOUR_ACCESS_KEY");
browserstackOptions.Add("aiAuthoring", "true");
capabilities.AddAdditionalOption("bstack:options", browserstackOptions);
$caps = array(
	'bstack:options' => array(
		"userName" => "YOUR_USERNAME",
		"accessKey" => "YOUR_ACCESS_KEY",
		"aiAuthoring" => "true"
	)
)
desired_cap = {
	'bstack:options' : {
		"userName" : "YOUR_USERNAME",
		"accessKey" : "YOUR_ACCESS_KEY",
		"aiAuthoring" : "true"
	},
}
capabilities = {
	'bstack:options' => {
		"userName" => "YOUR_USERNAME",
		"accessKey" => "YOUR_ACCESS_KEY",
		"aiAuthoring" => "true"
	}
}

Use the aiAuthoring capability as shown in the following code sample:

DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability("userName", "YOUR_USERNAME");
caps.setCapability("accessKey", "YOUR_ACCESS_KEY");
caps.setCapability("browserstack.aiAuthoring", "true");
var capabilities = {
 "userName" : "YOUR_USERNAME",
 "accessKey" : "YOUR_ACCESS_KEY",
 "browserstack.aiAuthoring" : "true"
}
DesiredCapabilities capability = new DesiredCapabilities();
capability.AddAdditionalCapability("userName", "YOUR_USERNAME");
capability.AddAdditionalCapability("accessKey", "YOUR_ACCESS_KEY");
capability.AddAdditionalCapability("browserstack.aiAuthoring", "true");
$caps = array(
 "userName" => "YOUR_USERNAME",
 "accessKeyild" => "YOUR_ACCESS_KEY",
 "browserstack.aiAuthoring" => "true"
);
desired_cap = {
 "userName" : "YOUR_USERNAME",
 "accessKey" : "YOUR_ACCESS_KEY",
 "browserstack.aiAuthoring" : "true"
}
caps = Selenium::WebDriver::Remote::Capabilities.new
caps["userName"] = "YOUR_USERNAME"
caps["accessKey"] = "YOUR_ACCESS_KEY"
caps["browserstack.aiAuthoring"] = "true"

If you do not specify the aiAuthoring capability, you will not be able to write natural language commands using AI Authoring.

Add BrowserStack executor

To enable natural language AI authoring, use the BrowserStack executor in your Appium test script as follows:

Copy icon Copy
Copy icon Copy
Copy icon Copy
Copy icon Copy

Natural language Authoring is currently supported only in portrait mode.

View results

AI authoring results are available on the App-Automate dashboard:

  • Successful execution: Displays success logs like standard App-Automate commands. Screenshot showing dashboard with results of successful ai authoring scenarios

  • Failure scenarios: Error logs show the failure reason. Screenshot showing dashboard with results of failed ai authoring scenarios

Possible errors include:

  • AI_CONTEXT_ERROR: Failed to gather relevant context for execution
  • AI_EXECUTION_FAILURE: Failed to perform required action
  • AI_AUTHORING_FEATURE_DISABLED
  • UNSUPPORTED_OBJECTIVE: Task is too complex. Please break it down.
  • AI_EXECUTION_FAILURE: Language/Framework not supported
  • AI_EXECUTION_FAILURE: unable to process request

Natural language AI authoring currently supports the following frameworks and OS:

  • Framework: Appium (language and test framework agnostic)
  • OS: Android & IOS
  • App type: Native apps

Best practices for writing natural language commands

To improve accuracy and reliability:

Start with an action verb

  • Example: Click the Submit button

Use one intent per command

Command 1:
Type watches for men in search box

Command 2:
Click on the last search result on the current page

Type watches for men in search box and click on the last search result on the current page

Be specific when providing instructions

Always specify exactly which element you want to interact with. This helps the AI understand your intent and reduces the chance of errors.

Click the Log In button

Click the button

Ensure element visibility in layout

Write natural language commands that target elements visible on the screen. If the element is not visible, include a scroll instruction in your prompt to help AI reach the target element.

Go to xyz.com and click on the hamburger icon, then click on the Login button

Go to xyz.com and click on the Login button

Combine simple objectives

  • Break complex objectives into smaller steps.

If you need to form complex commands, you can use connectors like and, or, or a comma to join multiple actions. However, we recommend keeping your commands simple and focused on one action at a time. Complex commands can reduce reliability and make it harder for the AI to interpret your intent accurately.

You can combine multiple actions in one command, but the AI is most accurate with single step instructions. For best results, especially with critical or complex tasks, break them into smaller, individual steps.

Write in clear English

  • Use concise English sentences for maximum accuracy.

Supported commands

The following table lists all commands which will be supported by our natural language authoring prompts:

Command Description
click/Tap Click the left mouse button
Double click Performs two rapid mouse clicks on an element
type Type a string of text
Press key
Enter,Tab,backspace
Simulates pressing a specific keyboard key
Scroll Moves the content view vertically or horizontally
Text validate Verifies an element’s text content matches an expected value
Visual validate Confirms an element is visible on the screen
Element validate Confirms the existence, visibility, or state of an element
extractValue Retrieves a specific value or attribute from an element

Key benefits

  • Write tests faster using plain English.
  • Reduce maintenance with resilient, locator-free steps.
  • Improve execution speed with intent-based commands.

  • Reuse the same tests across Android, and iOS without any modification.

Support

Reach out to support if you are facing any issues.

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked





Thank you for your valuable feedback

Is this page helping you?

Yes
No

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked





Thank you for your valuable feedback!

Talk to an Expert
Download Copy Check Circle