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 access variables in separate .sah file when using Sahi Excel framework
I have a .sah file that contains some variables (actually constants) that I want to use in my script. I prefer to store certain variables (user ids etc) in 1 location like this.
I know I can access these using _include from another .sah script - this is working fine for me.
However, if I want to access them when using the Excel framework, what should I do? My attempts are below - but they have failed. Any help would be great.
--
I have tried both of the following at the start of my .xls test but both fail with same error - 'logging exception - illegal character. I have checked the global_constants file and it looks fine to me.
1)
Key Word/Argument1
loadSahi "my_lib.sah"
loadSahi “global_constants.sah”
2)
loadSahi "my_lib.sah"
_include “global_constants.sah”
global_constants.sah looks like this:
//Global variables (actually, constants) used across all tests
var $userid1 = "john";
var $password1 = "1234";
var $userid2 = "jane";
var $password2 = "5678";
I know I can access these using _include from another .sah script - this is working fine for me.
However, if I want to access them when using the Excel framework, what should I do? My attempts are below - but they have failed. Any help would be great.
--
I have tried both of the following at the start of my .xls test but both fail with same error - 'logging exception - illegal character. I have checked the global_constants file and it looks fine to me.
1)
Key Word/Argument1
loadSahi "my_lib.sah"
loadSahi “global_constants.sah”
2)
loadSahi "my_lib.sah"
_include “global_constants.sah”
global_constants.sah looks like this:
//Global variables (actually, constants) used across all tests
var $userid1 = "john";
var $password1 = "1234";
var $userid2 = "jane";
var $password2 = "5678";
Answers
- Excel framework supports loading only one library using loadSahi (you can't use loadSahi more than once or pass more than one parameter to load a second library).
- Using _include keyword directly in Excel sheet is not accepted (illegal character error in logs).
- If I place _include in my own function and use that function in my Excel sheet to load a list of variables, I can't use those variables in the Excel sheet (they are undefined). Same if I try using loadSahi to load variables.
A shame, as I can do this outside of the Excel framework.
Is it really true that one can only loadSahi once ??
Could you please answer?
regards,
iwx1
loadSahi can be used multiple times.