UI-licious Cheatsheet
A quick reference guide to UI-licious commands for browser automation and testing.
Navigation and Page Info
Commands for navigating pages, refreshing, and asserting URLs and page titles.
Navigation
Commands for navigating to URLs, refreshing the page, and going back/forward in browser history.
UI-licious will automatically wait for page to fully load before on page navigations (triggered by I.goTo
, I.refreshPage
, I.click
, etc.)
| Navigate to a URL |
| Navigate to a URL with relative path |
| Open a new tab and navigate to a URL |
| Navigate to a URL with Basic Authentication |
| Refresh the current page |
| Go back to the previous page |
| Go forward to the next page |
URL and Page Title
Commands for getting and asserting the current page URL and title.
| Get the current page URL |
| Get the current page title |
| Assert the current page URL with absolute URL |
| Assert the current page URL with relative path |
| Assert the current page URL contains specific query parameters |
| Assert the current page URL contains specific hash |
Page Elements
Commands for asserting element visibility, text, attributes, and counts.
Visibility
Assertion commands for checking if elements are visible or not on the page.
UI-licious checks for element visibility to human eyes, not just presence in the DOM. An element is considered visible if it has non-zero width and height, and is not hidden via CSS (e.g. display: none
, visibility: hidden
, opacity: 0
, or positioned off-screen).
| Assert that an element is visible on the page using smart targeting |
| Assert that an element is visible on the page using CSS selector |
| Assert that an element is visible on the page using XPath |
| Assert that an element is NOT visible on the page using smart targeting |
| Assert that an element is NOT visible on the page using CSS selector |
| Assert that an element is NOT visible on the page using XPath |
Element Properties
Get or assert element properties such as text content, input values, CSS classes, attributes, and HTML content.
| Get the text content of an element using CSS or XPATH |
| Get the value of an input field using CSS or XPATH |
| Assert that an element has a specific CSS class |
| Assert that an element does NOT have a specific CSS class |
| Get the value of a specific attribute of an element using CSS or XPATH |
| Assert that an element has a specific attribute |
| Assert that an element has a specific attribute with a specific value |
| Assert that an element does NOT have a specific attribute |
| Assert that an element does NOT have a specific attribute with a specific value |
| Get the outer HTML of an element using CSS or XPATH |
| Get the inner HTML of an element using CSS or XPATH |
Element Count
Get or assert the count of elements matching a selector.
| Get the count of elements matching a selector |
| Assert that a certain number of elements are present on the page |
Mouse and Keyboard
Commands for mouse and keyboard interactions.
Click / Hover
Commands to click, double-click, right-click, and hover over elements.
UI-licious smart targeting locates elements by human-facing labels (e.g. labels, ARIA accessibility labels, text content, input field placeholders, nearby text) as well as tooltips (e.g. title, alt-text). It is case insensitive, and normalizes whitespaces and quotation marks.
| Click on an element with smart targeting (case insensitive) |
| Click on an element with CSS selector |
| Click on an element with XPath |
| Click on an element at a specific offset (x, y) from the top-left corner of the element |
| Click at a specific (x, y) coordinate on the viewport |
| Double click on an element |
| Right click on an element |
| Hover over an element |
Drag and Drop
Commands for dragging and dropping elements.
| Drag an element and drop it onto another element |
| Drag an element by a deltaX and deltaY pixels |
| Drag an element leftwards by a certain number of pixels |
| Drag an element rightwards by a certain number of pixels |
| Drag an element upwards by a certain number of pixels |
| Drag an element downwards by a certain number of pixels |
Scroll
Commands for scrolling the page.
| Scroll the page by a deltaX and deltaY pixels |
| Scroll the page upwards by a certain number of pixels |
| Scroll the page downwards by a certain number of pixels |
| Scroll the page leftwards by a certain number of pixels |
| Scroll the page rightwards by a certain number of pixels |
| Scroll to an (x, y) coordinate relative to the top-left of the page |
| Scroll to the top of the page |
| Scroll to the bottom of the page (for infinite scrolling pages, this scrolls to the bottom of the currently loaded content) |
Keyboard
Commands for keyboard interactions.
| Type text into the focused element |
| Press a key |
| Press multiple keys with modifiers |
| Press the |
| Press the |
| Press the |
| Press the |
| Press the |
| Press the |
| Press the |
| Press the |
| Press the |
Forms
Commands for filling and clearing input fields, selecting checkboxes and radio buttons, selecting options in dropdowns, uploading files, and handling alert dialogs.
Text Input
Fill, clear, and assert text input fields.
UI-licious smart targeting locates input elements by human-facing labels (e.g. labels, ARIA accessibility labels, placeholder text, input value, nearby text) as well as input name attribute. It is case insensitive, and normalizes whitespaces and quotation marks.
| Locate an input field with smart targeting and fill it with text |
| Locate an input field using CSS selector and fill it with text |
| Locate an input field using XPath and fill it with text |
| Assert that an input field has a specific value |
| Clear the text in an input field located with smart targeting |
Checkbox / Radio Button
Select, deselect, and assert checkboxes and radio buttons.
UI-licious smart targeting locates checkbox and radio button elements by human-facing labels (e.g. labels, ARIA accessibility labels, input value, nearby text) as well as the input name attribute. It is case insensitive, and normalizes whitespaces and quotation marks.
| Check a checkbox or radio button located with smart targeting |
| Check a checkbox or radio button using CSS selector |
| Check a checkbox or radio button using XPath |
| Assert that a checkbox or radio button is selected |
| Uncheck a checkbox located with smart targeting |
| Uncheck a checkbox using CSS selector |
| Uncheck a checkbox using XPath |
| Assert that a checkbox is NOT selected |
Select Dropdown
Select and assert options in dropdowns.
UI-licious smart targeting locates select elements by human-facing labels (e.g. labels, ARIA accessibility labels, input value, nearby text) as well as the input name attribute. It is case insensitive, and normalizes whitespaces and quotation marks.
| Select an option in a dropdown located with smart targeting |
| Select an option in a dropdown using CSS selector |
| Select an option in a dropdown using XPath |
| Assert that a specific option is selected in a dropdown located with smart targeting |
File Upload
Upload files to file input elements.
DO NOT click on the file input element to open the file dialog. Instead, use I.upload
to directly set the file path to upload.
| Upload a file to a file input located with smart targeting |
| Upload a file to a file input using CSS selector |
| Upload a file to a file input using XPath |
| Upload a file that was downloaded during the test |
Alerts
Handle alert, confirm, and prompt dialogs.
Alert / Confirm / Prompt dialogs must be accepted or dismissed when they appear before interacting with the page again.
| Assert that an alert / confirm / prompt dialog is open |
| Assert that an alert / confirm / prompt dialog is open with specific text |
| Accept an alert / confirm / prompt dialog |
| Dismiss an alert / confirm / prompt dialog |
| Fill the prompt dialog with text |
Targeting
Commands for improving element selection with smart targeting hints, and scoping interactions within iframes or specific DOM subtrees.
Hints for Smart Targeting
Provide hints to help the smart targeting engine locate related elements.
All I.see
commands will automatically drop hints for the smart targeting engine to use for the next command. You can also manually drop hints using I.see.hint("text")
which adds a higher weight to nearby elements when resolving the next command's target.
| Drop a hint on a related element to help with smart targeting for the next command |
Iframes and Subtrees
Scope interactions within iframes or specific DOM subtrees.
| Run commands within an iframe context |
| Target elements within a specific subtree of the DOM |
Storage
Commands for managing browser-side state such as cookies, local storage, and inspecting downloaded files.
Cookies
Set, assert, and delete browser cookies.
| Set a cookie with name and value |
| Set a cookie with options |
| Assert that a cookie with a specific name is set |
| Assert that a cookie has a specific value |
| Delete a cookie with a specific name |
| Delete all cookies available on the current page |
Local Storage
Get, set, assert, and delete local storage items.
| Get a local storage item by key |
| Set a local storage item by key and value |
| Delete a local storage item by key |
| Delete all local storage items |
Downloaded Files
Inspect and assert files downloaded during the test.
| Get a list of files downloaded during the test |
| Assert that a file is downloaded with a specific name |
| Assert that a file is downloaded matching a specific name pattern |
| Assert that a downloaded file has a minimum size in bytes |
Test Data
Commands for injecting dynamic test data from Datasets or loading test data from external files (e.g. JSON or CSV files).
Datasets
Use variables and secrets from configured Datasets in your tests.
| Use variables and secrets from Dataset. |
Load from File
Load test data from external files (e.g. JSON or CSV files).
| Load test data from a JSON file |
| Load test data from a CSV file with first row as header |
| Load test data from a CSV file with first column as header |
Window Management
Commands for controlling browser tabs, switching between them, closing tabs, and resizing the browser window or viewport.
Switch / Close Tabs
Open, switch between, and close browser tabs.
UI-licious will automatically switch to newly opened tabs when detected (e.g. when <a target="_blank">
link is clicked)
| Open a new tab and navigate to a URL |
| Switch to the next tab (cycles back to the first tab if on the last tab) |
| Switch to a specific tab by title |
| Switch to a specific tab by index (1-based) |
| Close the current tab |
Window / Viewport Size
Get and set the browser window and viewport size.
| Set the browser window size (includes browser UI like address bar) |
| Set the browser viewport size (excludes browser UI like address bar) |
| Get the current browser window width |
| Get the current browser window height |
| Get the current browser viewport width |
| Get the current browser viewport height |
Test Flow Control
Commands for controlling the flow of your test, including conditional flows, waits, running other tests, and stopping the test early.
Conditional Flows
Run commands conditionally using if
statements with I.see$
or other assertions.
| Run commands conditionally using |
Waits and Command Timeouts
Set explicit waits and configure command timeouts.
Interaction commands (e.g. I.click, I.fill, I.select, I.upload) automatically wait for elements to be visible (to humans) before attempting interaction.
Assertion commands (e.g. I.see, I.amAt, etc) will automatically retry until the assertion passes or timeout is reached.
The default command timeout is 15 seconds, which can be changed using TEST.setCommandTimeout(seconds);
.
Use explicit waits only when necessary.
| Wait for a specific number of seconds |
| Set timeout for all commands in the test |
Run Another Test
Run another test script from within the current test.
| Run another test script using absolute path |
| Run another test script using relative path |
Stop Test
Stop the test execution early.
| Stop test immediately |
| Stop test when a condition is met |
Advanced Scripting
Advanced commands for executing custom JavaScript in the page context and making HTTP requests from the browser context.
Execute JavaScript in the Page Context
Execute custom JavaScript code in the context of the page to interact with the DOM or retrieve information.
| Execute Javascript in the context of the page using a string |
| Execute Javascript in the context of the page using a function |
| Execute Javascript in the context of the page with arguments |
HTTP Requests
Make HTTP requests (GET, POST, PUT, DELETE, etc.) from the browser context.
These commands make HTTP requests from the browser context, so they are subject to CORS restrictions.
These commands are useful for retrieving test data from a remote server or setting up test state via APIs. We do not recommend using these commands for the purpose of API testing — please use a dedicated API testing tool instead.
| Make a GET request to a URL |
| Make a GET request to a URL |
| Make a POST request to a URL with JSON payload |
| Make a HTTP request with custom method, headers, and payload |
Test Outputs
Commands for capturing screenshots and printing custom log messages to the test report.
Screenshots
Manually take screenshots and control automatic screenshot capturing.
UI-licious automatically captures screenshots for every test command. It's not necessary to manually take screenshots unless you have set TEST.autoScreenshots = false;
in your test script.
| Take a screenshot of the viewport |
| Disable automatic screenshots for the rest of the test |
| Re-enable automatic screenshots for the rest of the test |
Logging
Log custom messages to the test report, assert conditions, and control logging behavior.
| Log a message to the test report |
| Log a message to the test report with passing status |
| Log a message to the test report with failure status |
| Assert a condition is true, otherwise fail the test with a message |
| Suppress errors for a command using $ postfix |
| Hide logs for a command using $$ postfix |
Frequently Asked Questions
What language does UI-licious run on?
Can I write custom functions?
Does UI-licious commands execute synchronously or asynchronously?
How does UI-licious smart targeting work?