PacMan wrote:Is there a way to capture a specific value of an Object property and store it as a variable to be used later?
For example:
There is a webedit field that always generates different values. I want to capture this field's value and store it as a variable so I can use this value as an input later on in my script.
I tried SaveSelectedObjProperties but it returns all ObjProperties for a particular idx. I also tried SaveSelectedText but it didn't write anything to the
response text file (even if it did work I would rather not limit my scripts to only capturing text).
There are three parts to the job of capturing a field value and storing it locally for later use:
(1) You have to identify the specific
sourceIndex at which the field's value is going to be stored. You probably will do this with an
IndexFindElement command, provided you know something about the element, for example, the name of the field that will contain the value.
You could use the
IndexFindElementEX command, which needs less input, but which may be much slower because it scans using a regular expression match rather than an exact match algorithm.
(2) Now that the
sourceIndex points to the right DOM element on the page, you can extract the value you want using the
ValueGetElement command, which will specify the name of the element you want to extract.
That command reads from the DOM and stores the value (it will be a string) in the internal variable
elementValue.
(3) Now the
elementValue can be written to a local file using the
ValueSave command, which will specify the file name to write it to (and whether that write should append to the existing file or not).
So summarize it is going to be the sequence
IndexFindElement,
ValueGetElement and
ValueSave, in that order.
(Note that there are reverse commands to take in a value, put it into a DOM element:
ValueRead and
ValuePutElement.
The eValid Team