Your e-Business Quality Partner eValid™ -- Automated Web Quality Solution
Browser-Based, Client-Side, Functional Testing & Validation,
Load & Performance Tuning, Page Timing, Website Analysis,
and Rich Internet Application Monitoring.

eValid -- Autosuggest Text Box Processing with Index/Motion Commands
eValid Home

Synopsis
Many applications now include AJAX-implemented autosuggest functions. A good example of this is the basic Google Search Function, which uses an AJAX capability to interrogate Google databases and make suggestions on a likely search target based on keyword matches found on their server.

This example script uses eValid index/motion and DOM manipulation commands to exercise this AJAX application.

  1. Navigate to the starting page with a standard InitLink command, and confirm that the page is present with a SyncOnElementProperty command that confirms the content of the value attribute.

  2. Use IndexFindElement to find the location of the input box, for which we know the name is q.

  3. Use an IndexInputValue command to type in "zzzz", a string that we know will produce some AJAX activity and result in a series of options displayed.

  4. Synchronize on the tagname and then the className values to confirm that the list is available.

  5. Move down two positions and send a "down arrow" event (code 40) into the text entry. This makes the multi-line display visible.

  6. Synchronize on the b pulldown property (it has to be "true") and then on the completeID property (which has to be "0") with SyncOnElementProperty commands.

  7. Choose the "best company" by finding where it is in the table, choosing it, and then sending an element click with a IndexElementClick command.

  8. The final results then show up in the next page.

Completed Script
The final recorded script is shown here.

# Recording by eValid V9 
# Copyright 2012 by Software Research, Inc. 

ProjectID "Project"
GroupID "Test"
TestID "autocomp"
LogID "AUTO"

ScreenSize 1152 864
DeleteCache
DeleteCookies

# Step 1: Navigate to starting page...
InitLink "http://www.google.com/"
SyncOnElementProperty 0 "value" "Google Search" ""

# Step 2: Find the text entry box...
IndexSet 0
IndexFindElement 0 DOWN "name" "q" ""

# Step 3: Feed in the "zzzz" data...
IndexInputValue 0 "TEXT" "zzzz" "" ""

# Step 4: Make sure the pulldown table is populated...
SyncOnElementProperty 0 "tagname" "TABLE" ""
SyncOnElementProperty 0 "className" "gac_m" ""

# Step 5: Re-position the sourceIndex to trigger the pulldown listings...
IndexMove +2
IndexElementEvent 0 "onkeydown" "keyCode" "40" ""

# Step 6: Synchronize to assure that the list items show up...
SyncOnElementProperty 0 "b" "true" ""
SyncOnElementProperty 0 "completeID" "0" ""

# Step 7: Choose "best company" by name, and click on it...
IndexFindElement 0 DOWN "innerText" " best company" ""
IndexElementMouseDown 0 ""
IndexElementClick 0 ""

# Step 8: Study the result screen that results from this search...

# End of Script