18 January 2026:
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
How to store value of input, not reference to...
Let assume that i have page with inputs "username" and "email".
I want to store values from this inputs into some hash object:
var $values = {};
$values["username"] = _textbox("username").value;
$values["email"] = _textbox("email").value;
But, for example, $values["username"] store not value, but "_textbox("username").value".
This introduce some problems. For example if i goes to another page and trying to test follow:
_assertEqual($values["username"], "some value here")
I've got exception that "username" element doesn't exist.
My question is why? Why $values["username"] hold "reference" instead of value of element?
p.s. i don't want to use _set or _setGlobal. For some reasons i need (to make test easy and generic) to store many values in hash and then iterate over that hash.
I want to store values from this inputs into some hash object:
var $values = {};
$values["username"] = _textbox("username").value;
$values["email"] = _textbox("email").value;
But, for example, $values["username"] store not value, but "_textbox("username").value".
This introduce some problems. For example if i goes to another page and trying to test follow:
_assertEqual($values["username"], "some value here")
I've got exception that "username" element doesn't exist.
My question is why? Why $values["username"] hold "reference" instead of value of element?
p.s. i don't want to use _set or _setGlobal. For some reasons i need (to make test easy and generic) to store many values in hash and then iterate over that hash.
Comments
var $values = {};
_set($values["User Name"], _textbox("username").value); // <--- this will be converted into setServerValue
And then somewhere on another page we can correctly check for value:
_assertEqual($values["User Name"], _span("username"));
_textbox("username").value is a stub. It will fetch the right value only when used from inside a Browser Action API or when fetched via _set.
Regards,
Narayan