Page 1 of 1

Comparing An Actual Value At Some DOM Dlement

PostPosted: Wed Aug 18, 2010 4:34 pm
by ylacct
How do I compare an actual value at some DOM element on the page with the value I EXPECT it to be? Can this be done inside a script?

Re: Comparing An Actual Value At Some DOM Dlement

PostPosted: Sun Aug 29, 2010 3:12 pm
by eValid
ylacct wrote:How do I compare an actual value at some DOM element on the page with the value I EXPECT it to be? Can this be done inside a script?

This requires use of some of the special eValid commands that can't be recorded from the GUI, but can be edited into the script. Here are the commands and the sequence you would use:

(0) Assume that you have the expected value stored away on your machine in a file called "expectedValue".

(1) Find the actual value's index in the page with an IndexSet command followed by an IndexFindElement command. This establishes where the "sourceIndex" will be pointing.

(2) Use a ValueGetElement command to pick up the value of the specific property at that "sourceIndex" location on the page, and put it in "elementValue".

(3) Use a ValueSave command to write the contents of the "elementValue" string to some local temporary file, for example, "currentValue".

(4) Use a CompareStrings command to see if the value you just wrote to "currentValue" is equal to [or not equal to] the value you previously stored in the file "expectedValue".

The result of the comparison will be OK if the values match, or ERROR if they do not. You'll see this show up on your playback EventLog.

The eValidTeam