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.

[sahi v1 -> v3 migration] package.name variables

zawistolzawistol Members
edited November -1 in Sahi - Open Source
Hi,
In sahi V1 I had a lot of constructions like example test.sah
In sahi V3 it stopped to work.
I tried different constructions like
$Categories.TEXT1 = "MyText";
OR
Categories.$TEXT1 = "MyText";
But I am getting FAILURES with message "$TEXT1" not found or "$Categories" not found
Lech


*************** library Categories.sah ********
function Categories()
{}

Categories.TEXT1 = "MyText";
******************************************

***************test.sah ********
_include("Categories.sah");
_setValue(_textbox("userID"), Categories.TEXT1);

******************************

Comments

  • zawistolzawistol Members
    I think the underlying problem is following
    In sahi V1 you can use
    TEXT = "ala";
    _setValue(_textbox("userID"), TEXT);

    In sahi V3 you must use
    var $TEXT = "ala";
    _setValue(_textbox("userID"), $TEXT);
    Lech
  • narayannarayan Administrators
    Yes Lech,

    You will have to make them $ variables.
    Btw, if they are all constants, you may try
    <browser>
    function Categories()
    {}
    Categories.TEXT1 = "MyText";
    </browser>
    

    I would recommend you to move to $ though.

    Regards,
    Narayan
  • zawistolzawistol Members
    hi Narayan,
    This looks like a bug in PACKAGE.VARIABLE evaluation. Can I report it to bug tracker?

    Please compare positive and negative example.

    ********************* POSITIVE *************
    function LIBRARY()
    {}
    LIBRARY.USER = "4000";
    var $temp = LIBRARY.USER ;
    _setValue(_textbox("login"), $temp);

    ********************* NEGATIVE*************
    function LIBRARY()
    {}
    LIBRARY.USER = "4000";
    _setValue(_textbox("login"), LIBRARY.USER);
    *******************************************

    Please also note, I cannot declare
    $PACKAGE.VARIABLE = "scott"
    because of JSERROR
    ReferenceError: "$LIBRARY" is not defined.
Sign In or Register to comment.