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.
I need help with Sahi syntax to obtain function name
/*
SOURCE
Callme();
function Callme (){
//var $funcName = arguments.callee.toString();
var $funcName = arguments.callee.caller.name.toString();
//var $funcName = document.activeElement.name.toString();
_alert($funcName);
}
*/
Whats wrong with above code?
SOURCE
Callme();
function Callme (){
//var $funcName = arguments.callee.toString();
var $funcName = arguments.callee.caller.name.toString();
//var $funcName = document.activeElement.name.toString();
_alert($funcName);
}
*/
Whats wrong with above code?
This discussion has been closed.
Comments
If you want the output to be "Callme", you need
var $funcName = arguments.callee.name;
Regards,
Narayan
this works; you may close this topic.
I needed this for troubleshooting when dealing with a lot functions.
I'm surprise this is not provided out the box for logging purposes.
/*
SOURCE
*/
CallMe();
function CallMe() {
logFunctionName ( argument.callee.name) ;
Call_Another_Function_2 ();
}
function Call_Another_Function_2 () {
logFunctionName ( argument.callee.name) ;
//Call_Another_Function_3 ();
}
/* --- Placed in Common Sah --- */
function logFunctionName ($funcName) {
_log("*********** " +$funcName " ************")
}
We have been working on a solution for this.
In the next build, errors and failures will automatically be shown with a trace of function calls.
You can also explicitly get the stack trace using _stackTrace();
I can send you an early release if you would like.
Regards,
Narayan