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.

global variable

rajendra_PASSrajendra_PASS Members
edited November -1 in Sahi - Open Source
Hi all,

Is it possible to use the variable from one script that is declared in another script without including the file in the script.

Comments

  • Hi rajendra

    see http://sahi.co.in/w/_getglobal

    Regards
    Wormi
  • TheeranTheeran Members
    edited November 2011
    Hi rajendra_PASS,

    You can use _setGlobal and _getGlobal API to do it.Declare _setGlobal in Script1,

    syntax:
    _setGlobal("variable1","value1");

    and declare _getGlobal in script2

    syntax:
    _set($variable1,"variable1");

    create a suite file using this two scripts and set the capacity option for the Browser Type to 1 for the Browser you wish to run in BrowserTypes.xml.Then,run the suite file,you will be able to use the variable from script1 in script2 without including the script1 in script2.

    Regards
    Theeran.
  • Thank you wormi and theeran.........
This discussion has been closed.