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.
Using _include(file name path); how can i call function from this file
Hi Team,
I am using the _include(file path\Script.sah) and have three function in the Script.sah as fun1, fun2 and fun3. now i have one more script called CallFun.sah in this script i want to call a function fun2 and fun3from Script.sah. how can i do it.
Please let me know.
below are the my code.
==CallFun.sah ===============
_alert("Started");
_include("C:\Users\sandeep_ss\sahi_pro\userdata\scripts\Scriptcall.sah");
_alert("After Include");
fnaddtwoNumbers(10,10);
_alert("End");
// here control is going to function but both the arguments values are null
========================================================
==== Scriptcall.sah=====
_alert("Start");
function fnaddtwoNumbers(a,b)
{
_alert(a); // here i am not getting any 'a' value here
_alert(b); // here i am not getting any 'b' value here
_alert("Inside Function");
c= a+b;
_alert(c);
}
_alert("End");
please look into it..
Thanks in Advance...
Regards,
Sandeep S S
I am using the _include(file path\Script.sah) and have three function in the Script.sah as fun1, fun2 and fun3. now i have one more script called CallFun.sah in this script i want to call a function fun2 and fun3from Script.sah. how can i do it.
Please let me know.
below are the my code.
==CallFun.sah ===============
_alert("Started");
_include("C:\Users\sandeep_ss\sahi_pro\userdata\scripts\Scriptcall.sah");
_alert("After Include");
fnaddtwoNumbers(10,10);
_alert("End");
// here control is going to function but both the arguments values are null
========================================================
==== Scriptcall.sah=====
_alert("Start");
function fnaddtwoNumbers(a,b)
{
_alert(a); // here i am not getting any 'a' value here
_alert(b); // here i am not getting any 'b' value here
_alert("Inside Function");
c= a+b;
_alert(c);
}
_alert("End");
please look into it..
Thanks in Advance...
Regards,
Sandeep S S
Comments
Kindly have a look at : http://sahi.co.in/forums/viewtopic.php?id=2708
Check if this solves your issue.
Regards
Sumitra
Note the piece that says 'All variables start with a $.'
Modify your script to do this:
==== Scriptcall.sah=====
function fnaddtwoNumbers($a,$b)
{
_alert($a); // here i am not getting any 'a' value here
_alert($b); // here i am not getting any 'b' value here
var $c= $a+$b;
return $c;
}
============
=== CallFun.sah =========
_include("C:\Users\sandeep_ss\sahi_pro\userdata\scripts\Scriptcall.sah");
var $temp = fnaddtwoNumbers(5, 6);
_alert($temp);
cheers,
evnafets