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.
JSERROR ReferenceError: "_log" is not defined
I'm getting an error message calling the _log function in my script.
First off, I am a little confused about this function - is it part of the API or not? It's listed in 'scheduler_functions.txt' but it is not in the API web page.
Secondly, I am getting the error message
"JSERROR ReferenceError: "_log" is not defined"
in the log file when I try to use it. I have seen many posts on this forum with people using the function, so it seems that they all know something I don't! I am trying to use this function because I am getting an absurd error in a later script which claims a similar error message when I call _assertExists(). For some reason, when I call this function from within a certain .sah script file it fails, but if I comment out the line and move it into the calling script, it executes...
The same is true of any of the usual core functions such as _assertTrue. i am trying to find some way, with _log(), to debug what is going wrong. At the moment, the only issue I can see is that Sahi is not wrapping calls to _log() and _assertExists() in _sahi.schedule()
Problem lines:
_log.("TEST");
_sahi._assertExists(_sahi._byId("dialog0"));
Normal:
_sahi.schedule("_sahi._assertExists(_sahi._cell(_sahi._table(1), 1, 0));", "D:\\sahi\\start.sah&n=6");
Can anyone shed some light on this?
I am using Sahi (Build: 2009-01-21)
First off, I am a little confused about this function - is it part of the API or not? It's listed in 'scheduler_functions.txt' but it is not in the API web page.
Secondly, I am getting the error message
"JSERROR ReferenceError: "_log" is not defined"
in the log file when I try to use it. I have seen many posts on this forum with people using the function, so it seems that they all know something I don't! I am trying to use this function because I am getting an absurd error in a later script which claims a similar error message when I call _assertExists(). For some reason, when I call this function from within a certain .sah script file it fails, but if I comment out the line and move it into the calling script, it executes...
The same is true of any of the usual core functions such as _assertTrue. i am trying to find some way, with _log(), to debug what is going wrong. At the moment, the only issue I can see is that Sahi is not wrapping calls to _log() and _assertExists() in _sahi.schedule()
Problem lines:
_log.("TEST");
_sahi._assertExists(_sahi._byId("dialog0"));
Normal:
_sahi.schedule("_sahi._assertExists(_sahi._cell(_sahi._table(1), 1, 0));", "D:\\sahi\\start.sah&n=6");
Can anyone shed some light on this?
I am using Sahi (Build: 2009-01-21)
Comments
Let me clarify. I have a root script which is calling a sequence of other scripts in order to test a feature: The function verifyCallLogSearchResults() is contained in the following testCallLogSearchResults.sah:
When 'ERROR LINE' is called, I get the error message "JSERROR TypeError: Cannot find function _assertExists". If I comment it out, the code runs fine. If i move the same line to the parent script at 'ALTERNATIVE' it runs fine.
To summarise, the _assertExists() function seems to disappear...
Apologies for my original post - I think it led you on a wild goose chase...
I am guessing that where you could substitute my _containsText with your _assertExists and achieve the same results. but the function must be called within a _set Statement as shown on line 2 of my Login function.
Hope this is of help
Donna
Which was throwing me a JSERROR ReferenceError
I changed it to how you suggested I call a function to set a variable's value.
And it worked fine.
So looks like _call cannot be used for setting variable values? Wish this was documented better.
Thanks for the feedback on the documentation. Could you please check now to see if it is any better?
http://sahi.co.in/w/_set
http://sahi.co.in/w/_call
Thanks and regards,
Narayan
Just wondering aloud here, wouldn't it be a good idea to have a wiki for the documentation so that users can update the documentation themselves?