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 check whether the tab is enabled.

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

I have tried with 'isDisabled' property,but it is always returning as 'false' when tab selected/not selected.
so please help me to check the enabled property of an tab using sahi.

Comments

  • narayannarayan Administrators
    A tab is not an html tag. You most probably have divs or tds working as tabs. You could post the html code here for a solution.
  • Show Users is the Tab name,

    <td id="groupSubscribers_lbl" onmouseover="RichFaces.overTab(this);"
    onmouseout="RichFaces.outTab(this);"
    class="dr-tbpnl-tb rich-tab-header dr-tbpnl-tb-inact rich-tab-inactive ">Show Users</td>
  • hi all,
    my problem hav't been solved . can any help me to resolve this problem.

    Regards
    Priya
  • narayannarayan Administrators
    Use:
    _assertTrue(_cell("groupSubscribers_lbl").className.indexOf("inactive") != -1)
    
    We are checking for the css className of the cell, and checking if it has the word "inactive" in it. If inactive was not found, indexOf would have returned -1.
  • Thanks Narayan,

    Its working, I have used the following code:

    var $tabshowusers;
    _set($tabshowusers,_assertTrue(_cell("groupSubscribers_lbl").className.indexOf("rich-tab-disabled") != -1));
    _alert($tabshowusers);

    This returns true if the tab is disabled.

    var $tabshowusers;
    _set($tabshowusers,_assertTrue(_cell("groupSubscribers_lbl").className.indexOf("rich-tab-active") != -1));
    _alert($tabshowusers);
    This returns true if the tab is enabled and selected.

    var $tabshowusers;
    _set($tabshowusers,_assertTrue(_cell("groupSubscribers_lbl").className.indexOf("rich-tab-inactive") != -1));
    _alert($tabshowusers);
    This returns true if the tab is enabled and not selected.
  • narayannarayan Administrators
    Priya,
    Glad it worked. However, the use of _assertTrue is incorrect in your code (even though it works).
    You can just do:
    _set($tabshowusers, (_cell("groupSubscribers_lbl").className.indexOf("rich-tab-disabled") != -1));
    
    No need to add _assertTrue.
  • Thanks a lot.
  • hi,
    how to check a button is disable..i tried with "isdisabled"

    "_isdisabled" is not defined.

    Thanks
    Rambabu
  • narayannarayan Administrators
    _assertTrue(_button("AAA").disabled)
  • hi,
    i need help...

    how to use isDisabled in an if condition??
    i want to check if it is disabled, then logs a message "combobox was disabled"..

    tnx for your help...
  • tnx for the help,,, but ive figured it out already...


    if(_condition((_select("cboAccount")).disabled)){
    _log("Combo box was disabled.","custom3");
    }
    else if(!_condition((_select("cboAccount")).disabled)){
    _log("Combo box was enabled.","custom3");
    }
  • narayannarayan Administrators
    Thanks Benj for posting the solution too. It will be useful for others facing the same problem.
    Regards,
    Narayan
This discussion has been closed.