|
Introduction
This page presents a short script that illustrates various eValid
DOM manipulation capabilities.
The script uses the
DOM Value Manipulation commands,
the
DOM Element Manipulation
commands, and the
DOM Input/Output commands.
You may also want to review these
Short Examples of DOM Manipulation Activity,
which explain in detail how to handle some standard primitive actions.
And, check out the
DOM Support Architecture description.
# Copyright © 2008 by Software Research, Inc.
ProjectID "Project"
GroupID "examples"
TestID "sequence"
LogID "AUTO"
ScreenSize 1280 1024
FontSize 0
DeleteCache
DeleteCookies
# ----------------------------------------------------------------------
# Step 1: Go to GOOGLE...
InitLink "http://www.google.com/"
# ----------------------------------------------------------------------
# Step 2: Position the index by finding the Google Search INPUT field...
ResetTimer
IndexSet 0
IndexFindElement 0 DOWN "name" "q" ""
# ----------------------------------------------------------------------
# Step 3: Set the value and save it to the EX.input.txt file...
ValueSet "eValid DOM Manipulation Command"
ValueSave "EX.input.txt"
# Read back the string placed in your "EX.input.txt" file...
ValueRead "EX.input.txt"
# ----------------------------------------------------------------------
# Step 4: Put the Element's VALUE property equal to the assigned value...
ValuePutElement 0 "value" ""
# ----------------------------------------------------------------------
# Step 5: Find the "Google Search" button and click to submit...
IndexFindElement 0 DOWN "name" "btnG" ""
IndexSubmitClick 0 ""
# ----------------------------------------------------------------------
# Step 6: Find and write the search result URL into EX.found.txt...
SyncOnText 0 "Results 1 " ""
IndexSet 0
IndexFindElement 0 DOWN "tagName" "P" ""
IndexMove +1
IndexFindElement 0 DOWN "tagName" "P" ""
ValueGetElement 0 "innerText" ""
ValueSave "EX.found.txt"
# ----------------------------------------------------------------------
# Step 7: Click on the first results instance for your search value...
IndexSet 0
IndexFindElement 0 DOWN "tagName" "H3" ""
IndexFindElement 0 DOWN "tagName" "A" ""
# ----------------------------------------------------------------------
# Step 8: Record where you found it...
IndexSave "EX.position.txt"
# ----------------------------------------------------------------------
# Step 9: Save the "innerHTML" and "URL" for the link you clicked...
ValueGetElement 0 "innerHTML" ""
ValueSave "EX.target.txt"
ValueGetElement 0 "href" ""
ValueSave "EX.url.txt"
ElapsedTime
# ----------------------------------------------------------------------
# Step 10: Finally, go to the referenced webpage...
IndexFollowLink 0 ""
# End of Script
DOM Illustration Screenshots
Here are screenshots showing the effect of the above command sequence:
Version Note
This script only successfully runs in eValid V8 #276 or later.
Earlier builds may produce a script syntax error.