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.

Intermittent value on _isVisible function

jeffreygjeffreyg Members
edited November -1 in Sahi - Open Source
Hi,

I'm having intermittent value received on checking the visibility of the object, sometimes it detect the object is visible and sometimes not (but the object is visible all the time), anyone can decipher if there's need correction on my script below:

_set($elemname, document.form1.elements[$x].name);
var $_elemname = $elemname;
_assertExists(_textbox($_elemname));
if(_condition(_isVisible(_textbox($_elemname))))
{
....
}

Thanks!

Comments

  • narayannarayan Administrators
    Hi Jeffrey,

    Looks like a bug. We will verify it here.

    Could you try this and tell us what you observe?
    _set($elemname, document.form1.elements[$x].name);
    var $_elemname = $elemname;
    _assertExists(_textbox($_elemname));
    
    _assert(_isVisible(_textbox($_elemname)));
    
    if(_condition(_isVisible(_textbox($_elemname))))
    {
    ....
    }
    

    Thanks,
    Narayan
  • Hi Narayan,

    Yes, I tried that also and it reflects on the logs that both the asserts are validated and passed status but failing on the if condition. The workaround i did was:

    _set($elemname, document.form1.elements[$x].name);
    var $_elemname = $elemname;
    _assertExists(_textbox($_elemname));

    _assert(_isVisible(_textbox($_elemname)));

    if(_condition(_isVisible(_textbox($_elemname))))
    {
    ....sometimes it goes here...
    } else if(_isVisible(_textbox($_elemname)))
    {
    ....and sometimes it goes here...
    }

    I'm not sure if this is the proper way. Any suggestion is very much appreciated. Thanks Narayan!
Sign In or Register to comment.