Command Reference

Complete reference for all test commands available in TrueAssert.

Overview

This reference lists all action types (commands) that can be used in test steps, their parameters, and usage examples.

Action Types

GOTO

Navigate to a URL.

Parameters:

  • Selector: Not used (empty)

  • Value: URL to navigate to

  • Selector Type: CSS (default, not used)

Example:

Action: GOTO
Value: https://example.com/login
Description: Navigate to login page

When to Use:

  • Start of test (navigate to starting page)

  • Navigate between pages

  • Go to specific URLs


CLICK

Click an element.

Parameters:

  • Selector: XPath or CSS selector for element

  • Value: Not used (empty)

  • Selector Type: XPATH or CSS

Example:

Action: CLICK
Selector: //button[@id='submit']
Selector Type: XPATH
Description: Click submit button

When to Use:

  • Click buttons

  • Click links

  • Click any clickable element

Requirements:

  • Element must be visible

  • Element must be clickable

  • Element must exist on page


FILL

Fill a form field with text.

Parameters:

  • Selector: XPath or CSS selector for input field

  • Value: Text to fill

  • Selector Type: XPATH or CSS

Example:

Action: FILL
Selector: //input[@name='username']
Selector Type: XPATH
Value: testuser
Description: Fill username field

When to Use:

  • Fill text inputs

  • Fill email fields

  • Fill password fields

  • Fill textareas

Requirements:

  • Element must be an input field

  • Element must be visible and enabled

  • Element must exist on page


WAIT

Wait for an element to appear.

Parameters:

  • Selector: XPath or CSS selector for element to wait for

  • Value: Not used (empty)

  • Selector Type: XPATH or CSS

Example:

Action: WAIT
Selector: //div[@id='loading']
Selector Type: XPATH
Description: Wait for loading to complete

When to Use:

  • Wait for elements to load

  • Wait for animations to complete

  • Wait for dynamic content

  • Wait before interactions

Timeout:

  • Default timeout applies

  • Element must appear within timeout period


SCROLL

Scroll the page.

Parameters:

  • Selector: Not used (empty)

  • Value: Scroll direction or amount (optional)

  • Selector Type: CSS (default, not used)

Example:

Action: SCROLL
Value: down
Description: Scroll down the page

When to Use:

  • Scroll to bring element into view

  • Scroll to load more content

  • Navigate long pages


PRESS

Press a keyboard key.

Parameters:

  • Selector: Not used (empty)

  • Value: Key to press (e.g., "Enter", "Escape", "Tab")

  • Selector Type: CSS (default, not used)

Example:

Action: PRESS
Value: Enter
Description: Press Enter key

When to Use:

  • Submit forms (Enter)

  • Close modals (Escape)

  • Navigate (Tab, Arrow keys)

  • Keyboard shortcuts

Common Keys:

  • Enter - Submit/confirm

  • Escape - Cancel/close

  • Tab - Next field

  • ArrowUp, ArrowDown, ArrowLeft, ArrowRight - Navigation


GET_HTML

Get HTML content of current page.

Parameters:

  • Selector: Not used (empty)

  • Value: Not used (empty)

  • Selector Type: CSS (default, not used)

Example:

Action: GET_HTML
Description: Get HTML content of current page

When to Use:

  • Used internally by AI test generation

  • Not typically used in manual tests

  • Used for page analysis

Note: This is primarily used by the test generation system, not manual test creation.


CLEAR_BROWSER

Clear browser state (cookies, localStorage, sessionStorage).

Parameters:

  • Selector: Not used (empty)

  • Value: Not used (empty)

  • Selector Type: CSS (default, not used)

Example:

Action: CLEAR_BROWSER
Description: Clear browser state before test execution

When to Use:

  • Automatically added at start of test execution

  • Ensures clean browser state

  • Prevents issues from previous sessions

Note: This is automatically added by TestExecutor, not manually created.


LOAD_SESSION

Load browser session data (cookies, localStorage, sessionStorage).

Parameters:

  • Selector: Not used (empty)

  • Value: Not used (empty)

  • Selector Type: CSS (default, not used)

  • Session Data: Provided via command context (not in step)

Example:

Action: LOAD_SESSION
Description: Load saved browser session

When to Use:

  • Automatically used during session validation

  • Used when use_predefined_session=True

  • Loads session for project's domain

Note: This is automatically created by LoginManager, not manually created.

Session Data Format:

{
  "cookies": [...],
  "localStorage": {...},
  "sessionStorage": {...}
}

SAVE_SESSION

Save current browser session data.

Parameters:

  • Selector: Not used (empty)

  • Value: Not used (empty)

  • Selector Type: CSS (default, not used)

Example:

Action: SAVE_SESSION
Description: Save browser session data

When to Use:

  • Automatically used after successful login

  • Saves session for future reuse

  • Stores session in database

Note: This is automatically created by LoginManager, not manually created.

What Gets Saved:

  • All browser cookies

  • localStorage data

  • sessionStorage data

  • Domain information


Command Execution

Execution Order

Commands execute in step order:

  1. Steps are executed sequentially

  2. Each step waits for previous to complete

  3. Failure stops execution (unless configured otherwise)

Command Validation

Before execution:

  • Selector validated (for commands requiring selectors)

  • Element existence checked

  • Element visibility verified

  • Element state checked (enabled, clickable)

Error Handling

If command fails:

  • Step status → FAIL

  • Error message stored

  • Screenshot captured (if enabled)

  • Execution may continue or stop (depends on configuration)

Usage Examples

Complete Test Flow

1. GOTO https://example.com/login
2. FILL //input[@name='username'] with "testuser"
3. FILL //input[@name='password'] with "password123"
4. CLICK //button[@type='submit']
5. WAIT //div[@id='dashboard']
6. CLICK //a[@href='/settings']
7. FILL //input[@name='email'] with "new@example.com"
8. PRESS Enter
9. WAIT //div[@class='success-message']

Form Submission

1. GOTO https://example.com/contact
2. FILL //input[@name='name'] with "John Doe"
3. FILL //input[@name='email'] with "john@example.com"
4. FILL //textarea[@name='message'] with "Test message"
5. CLICK //button[@type='submit']
6. WAIT //div[@class='success']
1. GOTO https://example.com
2. CLICK //a[@href='/products']
3. WAIT //div[@id='products-list']
4. CLICK //a[@href='/products/item-1']
5. WAIT //div[@id='product-details']
6. CLICK //button[@id='add-to-cart']
7. WAIT //div[@class='cart-notification']

← Back to Documentation

Last updated