Skip to main content
Skip table of contents

Functions for testing automation

Basic Functions for all Web Applications

This following table describes some basic functions used to perform various operations in UI tests.

FunctionDescription
(sim’useXPath xPath)

Sets the active control to a WebElement with the given XPath.

In this function, xPath is the XPath of control to be set as active.

(sim’click)Performs a left click on the active control.
(sim’rclick)Performs a right click on the active control.
(sim’dblclick)Performs a double left click on the active control.
(sim'hover)Performs a mouseover on the active control.
(sim'text)Retrieves the text content of the active control.
(sim’text text)

Writes text to the current active control.

In this function, text is the text that will be parsed and written into the control.

(sim’clear)Clears the current control of text.
(sim'attribute name)Returns the value of the named attribute for the HTMLElement representing the active control.
(sim’assertText text)

Asserts that the text content of the current control is equivalent to the supplied text.

In this function, text is the expected text.

(sim’assertXPathNotFound xPath)

Ensures that a control with the given XPath does not exist in the DOM.

In this function, xPath is the XPath of control to be set as active.

(sim’login URI)Logs into some application with the given URI address.
(sim'scrollIntoView)Scrolls the active control into the center of the screen.
(sim’quit)Closes the browser instance associated with this application's WebDriver.
(sim’addAttachment fileName content)

Adds a text attachment with the given file name and content to the active control.

 In this function, fileName is the attached file name that will be added to the active control.

(sim’addPDFAttachment fileName content)

Adds a valid PDF attachment with the given file name and content to the active control.

 In this function, fileName is the attached file name that will be added to the active control.

(sim’addPNGAttachment fileName content)

Adds a valid PNG attachment with the given file name and content to the active control.

 In this function, fileName is the attached file name that will be added to the active control.

(sim'waitUntil length)

Wait until lambda function returns true. Useful for waiting on a server invocation before proceeding with test.

Length of timeout is measured in milliseconds. Omit length to use default global timeout.

(sim'waitUntilStale)

Wait until chosen view is stale. Useful for clicking action buttons on nested dialogs.

(sim'waitForMovement)Wait until the active control has stopped moving for 2 consecutive animation frames.
(sim'assertValue)Assert DOM property on selected view.
Useful for assert control specific properties like style, model properties, and so on.
(sim'get)

Getter for DOM properties.
Useful for getting control specific properties like style, model properties, and so on.

(sim'executeJavascript)Advanced API for running JavaScript within a Scheme environment.

(sim'takeScreenshot fileName)

Takes a screenshot of the current screen. Omit the filename to set the filename to the current time.

In this function, fileName is the attached file name that will be added to the active control.

(sim'back)Loads the previous URL in the history.
(sim'forward)Loads the next URL in the history.
(sim'refresh)Refreshes the page.
(sim'title)Returns the title of the current page.
(sim'currentURL)Returns the URL of the current page.
(sim'localize stringID)Returns the caption of the defined stringID in the local of the loaded browser.  
(sim'localize stringID locale)Returns the caption of the defined stringID in the specified locale.
(sim'switchFrame frameID)Switches to defined application iFrame with given ID.  Null returns to parent document.
(sim'switchTab windowID)

Navigates to another tab using the window ID.

(sim'clickAssertSwitchNewTab)Opens a new tab by clicking on an active control. Switches to the new tab.
(sim'windowID)Extracts the unique window ID for the current window.
(sim'closeTab closeWindowID targetWindowID)Closes a window based on window ID and navigates to another tab using the window ID.
(sim'now)Returns the current time and day.  Can be used with uitest.time and uitest.timezone customizations to return specific time and date.
(sim'today)Returns the current day. Can be used with uitest.time and uitest.timezone customizations to return specific date.

Basic Functions for only AFL Portal Application

This following table describes some basic functions used to perform various operations in UI tests but are restricted to being used with the AFL Portal Application.

FunctionDescription
(sim’use viewPath)

Ensures that a control with the given semantic view path exists in the DOM and sets it as the active control.

In this function, viewPath is the semantic viewpath of the control.

(sim'drag path)Performs a drag and drop from the active control to the control represented by the given argument.
(sim’assertNotFound viewPath)

Ensures that a control with the given semantic view path does not exist in the DOM.

In this function, viewPath is the semantic viewpath of the control.

(sim’login username password)

Logs into some application with the given username and password credentials.

This supersedes the Web Application login for AFL Portal Application.
(sim’navigate workspace)

Navigates to a visible workspace with the given caption.

In this function, workspace is the caption of the workspace to navigate to.

(sim'enableAlarms Boolean)Enables alarms if Boolean value is equal to #t. Disables alarms if Boolean value is equal to #f.
(sim'appReadyCheck Boolean)Sets the value #t or #f to determine whether to execute App Ready checks. The application performs application ready checks to ensure it is finished loading before proceeding. In cases where the page under test is not a part of these checks (for example, third party windows), it may be necessary to turn the check off for automation.
(sim'appReadyCheck)Retrieves the current state of App Ready checks.
(sim'stats)Retrieves current session application performance statistics.

Helper Functions for all Web Applications

Helper functions provide a fast and easy way to perform a number of actions in the application.  It is preferable to use these where possible. 

Often these functions combine several basic functions in one to make code easier to write and follow.  When helpers are not granular enough for solving your use case, reverting back to basic functions is recommended.

FunctionDescription
(ui-clickXPath sim . xPath)Performs a click on the given XPath.
(ui-assertTextXPath sim expectedValue . XPath)Assert text value of given XPath.

Helper Functions for only AFL Portal Application

This following table describes some helper functions used to perform various operations in UI tests but are restricted to being used with the AFL Portal Application.

FunctionDescription
(ui-click sim . viewPath)Performs a click on the given view path.
(ui-rclick sim . viewPath)Performs a right click on the given view path.
(ui-dblclick sim . viewPath)Performs a double click on the given view path.
(ui-set-text sim clear? value . viewPath)Sets a text value in given view path, optionally by clearing it first.
(ui-clear sim . viewPath)Clears the value of given view path.
(ui-assertText sim expectedValue . viewPath)Assert text value of given view path.
(ui-assertIcon sim expectedValue . viewPath)Assert icon value of given view path.
(ui-assertValue sim propertyPath expectedValue . viewPath)Assert value of controller property path for given view path.
(ui-assertCell sim expectedValue row colName . viewPath)Assert text value of a given cell in a table. Retrieves cell by row index and column caption.
(ui-getValue sim propertyPath . viewPath)Get value of controller property path for given view path.
(ui-hover sim . viewPath)Perform a hover action on given view path.
(ui-getAttribute sim attribute . viewPath)Get DOM attribute value of a given view path.
(ui-view-enabled? sim . viewPath)Whether view path is enabled, based on the "disabled" DOM attribute.
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.