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.
(1) DOM functions vs <browser> tag (2) search ignores </browser>
Hi,
Short version
1. The short version of my question may be
do I use <browser></browser> tags around each function that uses DOM object?
or can I put 2 or more functions (and external variables?) in side the tags?
2. I tried to search on this but the search of "<browser>" finds every instance of browser
(side issue: search engine string parsing and keys like PgUp/PgDn, Ctrl-Home are odd:
do not navigate to top of page where search entry form element is. Still your format is very
easy to read with zero eyestrain.)
Long Version
1. I'm testing status messages of new form that creates a new Invoice, PO, Task, etc.
2. I use a function to extract and test messages like "Bug 9876 is now Assigned."
3. I have errors with and without the <browser></browser> tags
3.1. When around only the function(s) (and when I use _call(getvalue($dummy));
ReferenceError: "getValue" is not defined.
3.2. <browser></browser> around the the WHOLE SCRIPT (and the lines that call the functions)
ERROR: in controller (not shown in error / script log)
Object doesn't support this property or method (http://urlundertesthere.com/_s_/dyn/
Player_script/script.js?sahisid=sahi_ebd998820e2cf0415f083e909479e5f08bd9:17)
--Stopped Playback: SUCCESS--
(also echoed to controller DOS console)
Rhino lib:Step >_sahi._click(_sahi._span("Go To"));< did not complete in 150 seconds.
(that would be the next line after failure)
3.3 _currentPOnumber = _call(getValue(_textbox("main_grid2_1_textbox")));
(same as 3.2 "not defined")
also tried it with objDom and objDom.value with and without leading $
These questions arise:
A. what scope, or how to use the browser tags, perhaps searchable examples from Forums ? ^_^
B. Do I need to restart console when an error is logged as in #4 above
C. What in the blue blazes is wrong ... !@$@#$!@#$
<browser>
var $currentPOnumber;
function getValue($objDom)
{ var $someval = $objDom.value;
return $someval;
}
function msgStatusChange($strStatus)
{ // $msgStatusChange = "/PO [0-9].* status changed to /"+$strStatus+".";
return "/PO [0-9].* status changed to /"+$strStatus+"."; }
// _click(_span("/PO 5210 status changed to INPRG\./"));
_wait(_span(function msgStatusChange("INPRG")));
</browser>
var $currentPOnumber;
function getValue($objDom)
{ var $someval = $objDom.value;
return $someval;
}
function getValue2(objDom)
{ // var $someval = $objDom.value;
var $someval;
_setValue($someval, objDom.value);
return $someval;
}
Short version
1. The short version of my question may be
do I use <browser></browser> tags around each function that uses DOM object?
or can I put 2 or more functions (and external variables?) in side the tags?
2. I tried to search on this but the search of "<browser>" finds every instance of browser
(side issue: search engine string parsing and keys like PgUp/PgDn, Ctrl-Home are odd:
do not navigate to top of page where search entry form element is. Still your format is very
easy to read with zero eyestrain.)
Long Version
1. I'm testing status messages of new form that creates a new Invoice, PO, Task, etc.
2. I use a function to extract and test messages like "Bug 9876 is now Assigned."
3. I have errors with and without the <browser></browser> tags
3.1. When around only the function(s) (and when I use _call(getvalue($dummy));
ReferenceError: "getValue" is not defined.
3.2. <browser></browser> around the the WHOLE SCRIPT (and the lines that call the functions)
ERROR: in controller (not shown in error / script log)
Object doesn't support this property or method (http://urlundertesthere.com/_s_/dyn/
Player_script/script.js?sahisid=sahi_ebd998820e2cf0415f083e909479e5f08bd9:17)
--Stopped Playback: SUCCESS--
(also echoed to controller DOS console)
Rhino lib:Step >_sahi._click(_sahi._span("Go To"));< did not complete in 150 seconds.
(that would be the next line after failure)
3.3 _currentPOnumber = _call(getValue(_textbox("main_grid2_1_textbox")));
(same as 3.2 "not defined")
also tried it with objDom and objDom.value with and without leading $
These questions arise:
A. what scope, or how to use the browser tags, perhaps searchable examples from Forums ? ^_^
B. Do I need to restart console when an error is logged as in #4 above
C. What in the blue blazes is wrong ... !@$@#$!@#$
<browser>
var $currentPOnumber;
function getValue($objDom)
{ var $someval = $objDom.value;
return $someval;
}
function msgStatusChange($strStatus)
{ // $msgStatusChange = "/PO [0-9].* status changed to /"+$strStatus+".";
return "/PO [0-9].* status changed to /"+$strStatus+"."; }
// _click(_span("/PO 5210 status changed to INPRG\./"));
_wait(_span(function msgStatusChange("INPRG")));
</browser>
var $currentPOnumber;
function getValue($objDom)
{ var $someval = $objDom.value;
return $someval;
}
function getValue2(objDom)
{ // var $someval = $objDom.value;
var $someval;
_setValue($someval, objDom.value);
return $someval;
}
Comments
If you have a custom function for getting a browser attribute, use it in combination with _set.
Example:
Custom browser functions will mostly be used for two purposes:
1) Identifying an element using an identifier which is not supported by Sahi. In this case, the function can be called from any Browser Action API.
Example:
2) Fetching String or numeric values from browser elements, in a way that Sahi's in built APIs do not support. Use it in combination with _set
Hope that helps,
Regards,
Narayan
i want to get kiss.png
xxx.sah
both not works
test.sahi
(no response needed, but I'm always happy to read your improvements for a better way!)
this <browser></browser>feature "bites me again!"
I noticed this works, reporting each real value: but the same dom references do not work in until run, one-by-one through a function like this
*** Is there a way to overload (lazy way to skip the individual _set($sahiVar, for each dom var)
If not, this still works handily, thank you very much for the reminder to not use dom object in a for loop! It saved me quite a bit of time .. I only wasted 1/2 as much before rereading the forums!