Comparing An Actual Value At Some DOM Dlement

How to apply eValid to functional testing of web applications.

Comparing An Actual Value At Some DOM Dlement

Postby ylacct » Wed Aug 18, 2010 4:34 pm

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?
ylacct
 
Posts: 1
Joined: Wed Aug 18, 2010 3:54 pm

Re: Comparing An Actual Value At Some DOM Dlement

Postby eValid » Sun Aug 29, 2010 3:12 pm

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
eValid
 
Posts: 2395
Joined: Tue Jan 01, 2008 12:48 pm
Location: USA


Return to Desktop and Mobile Device Functional Testing

Design Downloaded from free phpBB templates | free website templates | Free Web Buttons