Natural language AI authoring
Use natural language to generate Selenium 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 browsers and devices.
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 desktop and mobile 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 Selenium 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 BrowserStack executor
To enable natural language AI authoring, use the BrowserStack executor in your Selenium test script as follows:
View results
AI authoring results are available on the Automate dashboard:
-
Successful execution: Displays success logs like standard Automate commands.
Natural language AI authoring test results are visible only on the new Automate dashboard.
-
Failure scenarios: Error logs show the failure reason.
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 browsers:
- Framework: Selenium (language and test framework agnostic)
- Browsers: Google Chrome, Microsoft Edge, Opera
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
Use quotes for exact values
- Example:
Click the "Add to cart" button
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
Make sure your natural language commands target elements on both, desktop and mobile web, that are visible on the screen. The AI will not interact with hidden elements.
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 |
Click the left mouse button |
type |
Type a string of text |
search |
Enter a query in a search field |
mousemove |
Move the mouse to a location |
hover |
Hover over an element |
scrollup |
Scroll vertically up |
scrolldown |
Scroll vertically down |
extractValue |
Extract the value of an element |
setValue |
Set the value of a given element |
openNewTabViaLink |
Open a link in a new tab or page |
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 web, 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
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!