Skip to main content
Experience faster, smarter testing with BrowserStack AI Agents. See what your workflow’s been missing. Explore now!
No Result Found
Get your setup working faster. Join our Discord for optimisation tips from elite testers. Join our DiscordJoin our Discord

Automate dynamic workflows with AI steps

Use natural language to perform dynamic actions and validations on your website.

Low Code Automation offers AI Interactions, a feature that lets you generate test steps using natural language prompts based on your website’s current state. Unlike traditional fixed steps that may break when your website changes, AI-generated steps dynamically adapt to the context during each test run.

For example, if you’re testing a flight booking flow and need to select today’s date, a fixed date selector might fail when the test is run on a different day. With AI Interactions, you can simply prompt: Select today’s date for departure, and the correct date will be automatically selected every time the test runs.

AI steps is available only in the Low Code Automation Pro and above plan. For more details, contact us.

Example Use Cases:

  • Enter any available date in the next month for departure and return dates: AI analyses the page, finds the next month, and selects any available date accordingly.
  • Ensure terms and conditions are mentioned in English: The AI verifies that the terms are in English, based on the current page.
  • Add to cart the first product from the search results having price greater than $20: The AI analyses the search results, identifies products priced over $20, and adds the first one to the cart.
  • Validate search results are sorted in ascending order of price: The AI verifies the current page to confirm that the terms and conditions are written in English.

Generate dynamic test steps with AI interactions

AI interactions are supported for both web and mobile resolutions.

  1. In the Low Code Automation recorder, go to the step where you want to generate an interaction, then click AI interactions.
    Click AI interactions
  2. Enter your prompt in the AI interactions text box. You can use natural language to describe any action or validation you want to perform. For example: β€œSelect today’s date for departure” or β€œVerify that the terms and conditions are in English.” AI Interaction text box
  3. Click ✨Perform to execute the action or validation. While the step is being performed, you can view the AI thoughts to understand what the AI is doing. If a test step fails due to the prompt, review these thoughts to refine your prompt accordingly. View AI thoughts
  4. Click Save recording when you are done.

Use the thumbs up or thumbs down buttons to share your feedback. Your input helps us improve and refine the AI prompts for better performance.

Best practices for writing AI prompts

To get the best results from AI interactions, keep these tips in mind.

Describe your goal, not just the clicks

State the outcome you want. The AI determines the steps and adapts when the UI changes. The following table compares click-by-click prompts with goal-oriented prompts:

Task ❌ Click-by-click βœ… Goal-oriented Why?
Login 1. Click username input
2. Enter random@example.com
3. Click password input
4. Enter Password123
5. Click login
Log in using the username "random@example.com" and password "Password123". Brittle click lists break on any layout change.
Add to cart 1. Click search
2. Type β€œiPhone 16”
3. Click the first result
4. Click β€œAdd to cart”
Search for "iPhone 16" and add the first result to the cart. Outcome-focused prompts have fewer brittle intermediate clicks.

Use text you can see on the screen

The AI finds elements by on-screen text and visual cues. Always reference what you can see, not DOM attributes or selectors. The following table compares hidden-selector prompts with visible-text prompts:

Element ❌ Hidden attribute or selector βœ… Visible text Why?
Product tile Click on product with data-test-id=”iPhone 16” and add to cart. Select the product iPhone 16 and add to cart. or Select the first red iPhone 16 and add to cart. The AI matches visible text, not the DOM.
Button Click element .btn-primary#submit-2. Click the "Place order" button. Visible labels survive selector refactors.
Ambiguous icon Click the icon. Click the cart icon in the top-right header. A unique visible description avoids wrong-element matches.

Be specific and avoid vague requests

Spell out the exact expected result. The more detail you give, the more accurately AI can perform your task. The following table compares vague prompts with specific prompts:

Situation ❌ Vague βœ… Specific Why?
Login error Test the login page. Verify that an error message "Incorrect password" appears when I log in with "user@example.com" and "wrong password". The AI knows the exact result to check.
Cart contents Check the cart. Verify the cart shows 2 items and a total of $40. Concrete values give a clear pass or fail.
Search results Make sure search works. Search for "iPhone 16" and verify at least one result title contains "iPhone 16". A query plus an assertion removes ambiguity.

Keep prompts focused on a single task

Break large, multi-goal objectives into focused steps. The AI handles one goal at a time, which is more accurate and makes failures easier to pinpoint. The following table compares overloaded prompts with prompts split into focused steps:

Scenario ❌ One overloaded step βœ… Split into focused steps Why?
Full shopping journey Search for β€œlaptops”, filter by brand Dell, sort by price low-to-high, add the first 3 results to the cart, apply coupon β€œSAVE10”, checkout with card 4242424242424242, and verify the order shows in Order History. 1. Search for β€œlaptops” and filter by brand β€œDell”.
2. Sort by price low-to-high and add the first 3 results to the cart.
3. Apply coupon β€œSAVE10” and complete checkout with card 4242424242424242, any CVV, and a future date.
4. Open Order History and verify the new order is listed.
Adding too many goals in one step lowers accuracy. Split steps show exactly where it broke.
Account onboarding Sign up with email β€œuser@example.com”, verify that a form is present, complete the profile with name and address, set notification preferences, and confirm the dashboard loads. 1. Sign up with email β€œuser@example.com” and password β€œPassword123” and verify that a form is shown.
2. Complete the profile with your name and address.
3. Set notification preferences and verify that the dashboard loads.
The flow spans multiple pages and states. One step can’t reliably carry all of it.
Bulk data actions Create 3 tasks, mark two of them complete, delete the first task, and verify only 2 tasks remain. 1. Create 3 tasks.
2. Mark the first two tasks complete and delete the first task.
3. Verify that exactly 2 tasks remain.
Repeated create, edit, and delete actions confuse a single step. Separate steps replay cleanly.

When to use AI interactions vs. the manual recorder

  • Recorder:
    • Recorder is built with powerful inbuilt features like making database calls, API calls, loops, etc.
    • Use recorder for any simple, static workflow automations that do not require any change if the application changes. For example: logging in to webpage, filling out static forms, etc
  • AI Interactions: The test step recorded has to adapt to the application changes. For example:
    • Selecting dynamic date inputs
    • Validating results are sorted in ascending order
    • Selecting a product with 5-star rating
    • Filling only mandatory fields in a dynamic form
    • Validating page content is in English
    • Adding any red colored iPhone to the cart

Supported actions for AI interactions

AI interactions support the following types of user actions:

  • Click
  • Text input
  • Hover
  • Scroll up
  • Scroll down
  • Extract value from UI

Unsupported actions for AI interactions

AI interactions do not support the following types of user actions:

  • Non-functional actions or validations that involve accessibility, security, load and performance testing scenarios
  • Any step that involves validating beyond browser application UI: Network logs, console logs, DOM elements, etc, browser navigation
  • Any language code in prompts

Import variables in AI interactions

You can import variables directly into your AI step prompts to reuse values and make your tests more dynamic. This allows you to reference global variables, test dataset values, or other test variables in your prompt.

Imported variables can be used in your prompt to dynamically generate actions or validations based on the variable’s value. This is especially useful for:

  • Running the same test with different data sets
  • Referencing values extracted from previous steps
  • Making your AI interactions more flexible and maintainable

To use a variable in AI Interactions:

  1. In the AI interactions prompt box, type @ to view available variables. Alternatively, click the + icon below the prompt box and choose the variable you want to import. Type @ to view available variables
  2. Select from global variables, test dataset values, or other test variables.
  3. Reference a variable in your prompt. For example:
    Open the Wikipedia page for @Topic and verify the first paragraph contains @expectedText
    This prompt uses the values of the Topic and expectedText variables during test execution, allowing you to validate different Wikipedia pages and their content dynamically. Screenshot showing how to add variables in a sample prompt

Currently, Secrets are not supported within AI interaction prompts.

For more details about creating and using variables and global variables, see Variables and Global variables.

Edit AI steps

You can edit the step by modifying the prompt even after execution. Click the Edit icon next to the AI interaction to update the prompt and regenerate the step. Edit AI prompts

The prompt window appears. You can edit the existing prompt or enter a new one.

Replay AI steps

The image shows a validation and action step executed through AI interaction. Each time the step runs during replay, it uses AI based on the provided prompt. You can expand the View AI thoughts button to see how the AI analyzes and decides how to execute the step.

Screenshot of execution of AI interactions

  • Each test can include up to 20 AI-generated steps.
  • You can use up to 500 AI step executions per user per month. Every time an AI step is recorded or executed, whether during recording, local runs, or cloud runs, it counts as one execution. For further assistance, contact BrowserStack support.

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