Share this page

# ajax_autocomplete

Note: This protocol is supported for replay only. Support for this protocol will be discontinued in future versions..

We recommend that you migrate your Ajax Click & Script scripts to another web protocol such as TruClient-Web or Web-HTTP/HTML.

For details, see Web Vuser Functions (WEB) and TruClient protocols in the VuGen Help Center (select the relevant version).

Selects an item from a list based on text entered in a field.

Example: ajax_autocomplete | Alphabetical Listing

    int ajax_autocomplete( "stepname", DESCRIPTION, "Framework=framework name", "ID=control_id", ACTION, "UserAction=Set|Select", "Value = value", ["SelectByText"|"SelectByOrdinal=n",] LAST );

This function returns LR_PASS (0) on success or LR_FAIL (1) on failure. Note that LR_PASS and LR_FAIL generally indicate whether the function call completed without an exception, and not that the test step succeeded.

All input string arguments (char type) except the step name can be parameterized using standard parameterization.

Function Arguments table

Argument | Description
--- | ---
StepName | The name of the step, as it appears in the test tree. Any text can be used.
Framework | The software used to create the AJAX application. For this function, the "`Atlas"` and``"Scriptaculous" frameworks are supported.
ID | The control ID.
UserAction | "Set" to enter a literal value, or "Select" to get the value from the list that opens when a value is entered in the text box.
Value | The value entered in the text box.
SelectByText / SelectByOrdinal | Enter the Value, then select from the list. SelectByText is the complete text of the selected item, even if it includes Value. SelectByOrdinal is the position of the selected item in the sub-list of items that match the Value.

General Arguments table

Argument | Description
--- | ---
DESCRIPTION | This delimiter marks the beginning of the list of attributes that identify the element on which the function operates.
ACTION | This delimiter marks the beginning of the action list. When there are no action-type arguments, this argument can be omitted, but it is not an error to specify it.
LAST | This delimiter marks the end of the argument list.

## General Information

The ajax_autocomplete function emulates a user setting the value of an autocomplete-enabled edit field, called an autocomplete control.

If the "Set" action is used, the value of the control is set to the literal string passed in the Value argument.

If the "Select" action is used, the step waits for the autocomplete list to be displayed, then sets the control's value to the literal SelectByText value or to the value of the matching item at the position specified by SelectByOrdinal.

If SelectByText is used and the specified text does not appear in the list, the function fails.

If SelectByOrdinal=n is used and the number of list items that match the Value is less than n, the step fails. SelectByOrdinal is never recorded. It can be entered manually.

A random item can be selected by specifying "SelectByOrdinal=random".

The function pauses randomly to simulate a user typing. This allows requests to be sent to the server.

Note: The select operation fails with script.aculo.us versions prior to 1.8.

Tips to improve your search results... VuGen Function Reference Version 25.1-25.3 Function Reference 25.1-25.3 All View Local Help Center View Online Help Center Version: