18 January 2026:


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

danielallamdanielallam Members
edited April 2013 in Sahi Pro
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";

Answers

  • danielallamdanielallam Members
    edited April 2013
    Still not had any luck with this. My hunch is that I can't use the Excel framework when trying to use _include or loadSahi to set some global variables.
  • danielallamdanielallam Members
    edited April 2013
    Ok - after further investigation, my conclusions are below. As far as I can see, _include can't be used with the Excel framework to load global variables. I could of course be wrong. Feel free to tell me if so. I would love to get this working.

    - 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.
  • HI Narayan,
    Is it really true that one can only loadSahi once ??

    Could you please answer?
    regards,
    iwx1
  • narayannarayan Administrators
    Nope.
    loadSahi can be used multiple times.
Sign In or Register to comment.