Skip to main content
No Result Found
Connect & Get help from 6000+ developers on our Discord community. Ask the CommunityAsk the Community

Execute commands

Write tests using DSL commands in Salesforce Test Automation.

Salesforce Test Automation allows you to create automated tests using DSL (Domain-Specific Language) commands. You can describe user interactions using simple command syntax in the test editor. This makes test writing faster, easier, and more intuitive.

As you write in the test editor, Salesforce Test Automation automatically suggests valid commands, reducing guesswork and speeding up test creation. You can select commands from the dropdown or use natural language to describe actions.

How to use these commands

When typing an action input, specific commands will appear in the suggestion dropdown:

  • Select from dropdown: Click the suggestion to lock in the command syntax (for example, Type <Value> in <Element>). You need to replace the <Value> placeholder with the actual data you want to enter, and replace <Element> with the exact name of the field or button as it appears on the screen.
  • Natural language: If you type a phrase (for example, ‘click new button’) without selecting a suggestion, it will be treated as a standard natural language command.

This section covers the following supported commands:

Core interactions

Use these commands to interact with UI elements on your Salesforce application.

Command Syntax Description Example
Click element Click <Element> Single click on a UI element (buttons, links, logos). Click New
Type value Type <Value> in <Element> Inputs value in a specific field. Type Smith in Last Name
Type Type <Value> Inputs value in already selected field. Type Smith
Search Search <Value> in <Element> Search for a given value. Search Ryan in Lead List
Select (combobox) Select <Value> from <Element> Selects one option from dropdown. Select Google from Account Name
Choose (Multipicklist) Choose <Val1; Val2> from <Element> Chooses one or more options (separated by ;) from a multi-picklist. Choose Percy; Automate from Products
Populate lookup field Populate <Element> with <Value> Searches and selects a value in a Lookup Field. Populate Account Name with Google
Select date Select Date <Value> from <Element> Picks a specific date from a date picker. Select Date 23/06/2025 from DOB
Select time Select Time <Value> from <Element> Picks a specific time from a time picker. Select Time 12:23 AM from Appointment
Drag & Drop Drag <Element> to <Target> Moves an item from one location to another. Drag Dynamo X1 to Product Drop section
Clear Clear <Element> Clears text from a field. Clear Username

Assertions (Validations)

Use validation commands to verify expected outcomes and element states during your test execution.

Command Syntax Description Example
Assert element exists Assert <Element> exists Asserts that a specific element is present on the page. Assert Account Name exists
Assert element does not exist Assert <Element> does not exist Asserts element is not present on the page. Assert Delete button does not exist
Assert value exists Assert <Value> exists Asserts value is present on the page. Assert 40 funds exist
Assert value does not exist Assert <Value> does not exist Asserts value is not present on the page. Assert 40 results does not exist
Assert equals Assert <Element> equals to <Value> Asserts element value equals to the specified value. Assert Stage equals to Closed Won
Assert not equals Assert <Element> Not Equals to <Value> Assert element value not equals to the specified value. Assert Stage Not Equals to Closed Lost
Assert contains Assert <Element> contains <Value> Asserts element value contains the specified substring. Assert Error Message contains System Error
Assert does not contain Assert <Element> does not contain <Value> Asserts element value does not contain substring. Assert Error Message does not contain System Error
Assert less than or equal Assert <Element> is less than or equal to <Value> Asserts element value is less than or equal to the specified number. Assert Quantity is Less Than or equal to 100
Assert greater than or equal Assert <Element> is greater than or equal to <Value> Asserts element value is greater than or equal to the specified number. Assert Number of Employees is Greater Than or equal to 50
Assert less than Assert <Element> is less than <Value> Asserts element value is less than the specified number. Assert Quantity is less than 100
Assert greater than Assert <Element> is greater than <Value> Asserts element value is greater than the specified number. Assert Number of Employees is greater than 50
Assert starts with Assert <Element> starts with <Value> Asserts element value starts with the specified value. Assert Last Name starts with Steve
Assert does not start with Assert <Element> does not starts with <Value> Asserts element value does not start with the specified value. Assert Last Name does not start with Steve
Assert matches regex Assert <Element> Matches Regex <Pattern> Asserts value matches a Regular Expression. Assert Phone Number Matches \d{3}-\d{3}-\d{4}
Assert element is checked Assert <Element> is checked Asserts checkbox or radio button is checked. Assert Email opt out is checked

Browser and navigation

Use these commands to control browser navigation and page actions.

Command Syntax Description Example
Refresh page Refresh Reloads the current page. Refresh
Go back Go back Navigates to the previous page in history. Go back
Go forward Go forward Navigates to the next page in history. Go Forward
Assert URL Assert URL equals to <Value> Asserts current URL equals to the specified URL. Assert URL equals to www.Browserstack.com

Waits and utilities

Use these utility commands to manage test execution flow and timing.

Command Syntax Description Example
Wait Wait for <Time> Seconds Pauses execution for a fixed time. Wait for 3 Seconds
Wait for element Wait for <Element> Pauses until a specified element appears. Wait for Save Button
Wait for element to enable Wait for <Element> to enable Pauses execution until a specified element is enabled. Wait for Save Button to enable
Scroll to element Scroll to <Element> Scrolls to a specific element. Scroll to Products & plans
Scroll within specified area Scroll to <Element> in <Scrollable area> Scrolls to a specific element inside a defined scrollable area. Scroll to Products & plans in Lead creation form
Hover Hover over <Element> Hovers mouse over an element. Hover over User Profile Icon
Store element value Store <Element> value in <Variable> Stores element value into a variable. Store Opportunity ID value in OID
Scroll up Scroll Up Scrolls view up by 75% screen height. Scroll up
Scroll down Scroll Down Scrolls view down by 75% screen height. Scroll down
Scroll to top Scroll to Top Scrolls view to page start. Scroll to top
Scroll to bottom Scroll to Bottom Scrolls view to page end. Scroll to bottom
Click table cell Click on Row <Row Number> and Column <Column Name> Clicks on element inside a specific table cell defined by row and column. Click on Row 1 and Column Name
Type in table cell Type <Value> in Row <Row Number> and Column <Column Name> Enters text into a specific table cell defined by row and column. Type John in Row 1 and Column Name
Store table cell value Store Row <Row Number> and Column <Column Name> in <variable> Stores a table cell value into a variable. Store Row 1 and Column Name in Last Name
Assert table cell contains Assert Row <Row Number> and Column <Column Name> contains <Value> Assert table cell contains the expected value. Assert Row 1 and Column Name contains John
Hover over table cell Hover Over Row <Row Number> and Column <Column Name> Hovers over a specific table cell defined by row and column. Hover Over Row 1 and Column Name

Best practices for entering commands

Follow these best practices to ensure your tests are simple, fast, and reliable:

  • Be specific: For best results, use the exact labels displayed in the UI as element names. After selecting a command, replace placeholders with your data (for example, Type John in Last Name).
  • Refine on failure: If a command fails, try adding a field type for more clarity (for example, Type John in Last Name Input Field).
  • Use exact element names: Enter the exact label as it appears on the screen. Salesforce Test Automation uses exact string matching for labels, making this approach simple, fast, and reliable.

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