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 -- UPS Rate Estimation with Motion Commands
eValid Home

Summary
This page presents an eValid solution to a publically posed problem that requires analyzing a website to extract rate information. The script involved:

  1. Navigates into the target website, a shipping company.
  2. Selects (from a parametric list of user-supplied values) an origin city and a destination city.
  3. Navigates to the rate calculation page.
  4. Saves the "Selected" text area containing the rate information for off-line analysis.

The eventual eValid script uses Data Synthesis to incorporate parametric data (origin/destination city pairs) so that the rate variations can be studied efficiently.

Problem Statement
Here is the original problem statement, as posted on comp.software-eng:

Script Development Process
To develop the time and cost calculation script and save the Time and Cost related data, we organized the script development process into multiple steps, described here in detail:

  1. Starting Page
    Navigate go to the http://www.ups.com webpage; this is where each playback will begin.
    Once there we can proceed to CALCULATE the available Time and Cost for sending a 1 lbs. UPS Letter.

  2. Choose Script Name
    Start the Recording, and choose the script filename, i.e. "ups"...

  3. Choose Location
    Choose the location, i.e. "United States - English"...

  4. Select Goal
    Select what you are looking for, in this case "Calculate Time and Cost"...

  5. Provide Shipment Information
    Provide the shipment details and then click on "Next"...

  6. Provide Shipping Details
    Provide the additional required shipment details and then click on "Next"...

  7. Results Displayed
    At this point in the playback you will see a page that provides the "Time and Cost Summary" for a variety of shipping options. This is the page that contains the results you want. (Later, we'll save the visible text contents of this page for post-run analysis).

  8. Selecting the "View Details" Link
    For more details, you can CLICK on the corresponding shipping option's icon/link for the "Time and Cost Detail". This is the page that only contains details for the selected service. (You can highlight and save selected text contents from this page for post-run analysis).

  9. End Recording
    Stop the script recording process and note that the script has been filed in the specified filename.

  10. Adjust Script to Save Data
    Now, make a manual edit of the script to include a "SaveSelectedText" command that will save all or some of the data on the target page for later analysis. At the same time, modify the script so that there are parameters for each of the values that will be substituted automatically. In this case the variables are $CITY, $ZIPCODE, and $OUTPUT (the name of the output file).

  11. Set Up Data Synthesis File
    We will be using the DataSynthesis feature to parameterize different input/output shipping cost iterations. To do this we need to set up a DataSynthesisFile called input.txt.

    We populate this file with 5 predetermined shipping locations so that, at script playback time, eValid will generate 5 associated service calculations. The information is passed to eValid as a set of $NAME/$VALUE pair substitutions.

    NOTE: Each $NAME=$VALUE pair is separated by a space and each iteration is denoted by a RETURN, also differentiate a character SPACE using %20, etc. Here is the contents of the Data Synthesis file [for five shipping destination variations]:

  12. Add DataSynthesisFile Details To Script
    Now, manually edit the .evs script file to include declaring the "DataSynthesisFile" to be used. This is the file which contains the $NAME=$VALUE fields.

    Before Editing...

    After Editing...

  13. Add Motion Commands to Arrive at Rate Value
    Now, make a manual edit of the script to include a set of internal index motion moves so that we can arrive at the desired "View Details" link. Knowing we are at the right place on the page, we replace the original "InputImageClick..." with a IndexFollowLink command.

  14. Choose eValid Settings
    Change your "eValid: Settings -> Record/Play Prefs -> Project/Log Management -> Log Output" settings to those appropriate for a DataSynthesis run. To generate an event log with all 5 iterations being played back, we need to make sure that "Append to Logs" is enabled, as shown here:

  15. Start Playback in Correct Mode
    To run the script in Data Synthesis mode, you need to make the selection "Playback->Control Playback->Run Synthesized", as shown here:

  16. Wait For Playback Completion
    When "Run Synthesized" has reached the end of playback -- having run the script one time for each line in the Data Synthesis file -- eValid will indicate completion, as shown here:

    OR, in case any eValid Adaptive Playback actions were needed to preserve the script integrity, you'll see this display:

  17. Confirm Output Files
    Play back completion will result in producing five output files, named according to the specification in the DataSynthesis file. They contain the data on the service available for each of the five input pairs. Here are the files:

  18. Examine Output Files
    Here is a sample of one of these output files:

  19. Completed Script
    Here is the eValid script that shows the results of the recording and script preparation process. You can download the DataSynthesisFile "input.txt".
    CAUTION! You will probably have to modify the "shipDate" accordingly, as this page and/or environments may differ from the initial creation point!

    # 
    # Recording by eValidô V9 Build #291
    # Copyright © 2009 by Software Research, Inc. 
    # Recording made on: Microsoft Windows Vista Service Pack 1 (IE 7.0), HostName "aruba"
    # 
    
    ProjectID "Project"
    GroupID "Group"
    TestID "ups"
    LogID "AUTO"
    
    
    ScreenSize 1440 900
    FontSize 1
    DeleteCache
    DeleteCookies
    
    DataSynthesisFile "input.txt"
    
    InitLink "http://www.ups.com/"
    Wait 4173
    InputValue 0 67 "SELECT-ONE" "" "cookie" "United States - English" "1" ""
    Wait 2706
    InputImageClick 0 329 "http://www.ups.com/img/btn_arrow_large.gif" "Go" ""
    Wait 5101
    FollowLink 0 369 "Calculate Time & Cost" "javascript:com_ups_rif.togglePanel('CTC');" "" NO_NAV
    Wait 5289
    InputValue 0 408 "TEXT" "" "weight" "3.0" "" ""
    Wait 5315
    InputValue 0 652 "TEXT" "origPostalValue" "origPostal" "94103" "" ""
    Wait 4925
    
    # Originally Recorded Value...
    #InputValue 0 933 "TEXT" "destPostalValue" "destPostal" "90024" "" ""
    # Manually Edited Parameterizataion Value Using DataSynthesisFile...
    InputValue 0 933 "TEXT" "destPostalValue" "destPostal" "$ZIPCODE" "" ""
    
    Wait 125
    InputValue 0 940 "CHECKBOX" "residentialBox" "residentialBox" "01" "TRUE" ""
    Wait 1841
    SubmitClick 0 943 "" "" "Continue" "" NAV
    Wait 5103
    SubmitClick 0 486 "" "0.y" "View Details" "" NAV
    Wait 3746
    
    # Adding Synchronization(s) assure arrival at the designated calculation webpage...
    SyncOnText 0 "Service Details" ""
    SyncOnText 0 "Shipment Total:"
    Wait 1779
    ValidateSelectedText 0 439 0 "Service Details" ""
    Wait 6396
    ValidateSelectedText 0 520 0 "Ship To: " ""
    
    # Manually ADDED in Script Commands to SAVE the Time and Cost Outputs...
    IndexSet 0
    IndexFindElement 0 DOWN "innerText" "Modify Shipment Information" ""
    IndexMove +6
    ValueGetElement 0 innerText ""
    ValueSave "$OUTPUT.txt"
    
    IndexSet 0
    IndexFindElement 0 DOWN "innerText" "Guaranteed By: " ""
    IndexMove +1
    ValueGetElement 0 innerText ""
    ValueSave "$OUTPUT.txt" APPEND
    
    IndexFindElement 0 DOWN "tagName" "DD" ""
    ValueGetElement 0 innerText ""
    ValueSave "$OUTPUT.txt" APPEND
    
    IndexSet 0
    IndexFindElement 0 DOWN "innerText" "Shipment Total: " ""
    IndexMove +1
    ValueGetElement 0 innerText ""
    ValueSave "$OUTPUT.txt" APPEND
    
    # End of script.