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 ignore invisible DOM Elements

sbasba Members
edited March 2011 in Sahi - Open Source
Hi,

I've got the following problem:
Our product uses the ZK framework with a lot of tabs. In every tab there are buttons with the same images. If a new tab gets opend, zk sets the current tab to "display: none" and opens the new one.

If i want to press one of these buttons via Sahi (with the image-name as selector, e.g.: _image("refresh.png")), it seems that it tries to press the invisible button of the other tab. The button of the visible tab has an higher index (depends on how many tabs are opend).

This problem applies to some other components too.

How can i ignore these invisible DOM-Elements? If i call _click(_image("refresh.png")) i want Sahi to click the (only) visible button with that name.

Stefan

Comments

  • narayannarayan Administrators
    Hi Stefan,

    Please have a look at this post and see if the solution applies to you: http://sahi.co.in/forums/viewtopic.php?id=2124

    Regards,
    Narayan
  • sbasba Members
    Thanks, Narayan.
    That works for me.
    Do you already know when the support for conditional filtering will be implemented?
  • narayannarayan Administrators
    Hi Stefan,

    Glad that worked. We will be looking at it in the coming couple of weeks. Should be available in April release.

    Regards,
    Narayan
  • sbasba Members
    edited March 2011
    Hi Narayan,

    When will the April release be available?
    This feature is very important to us and i would have to implement the workaround for every element-type.

    Is there a patch i could apply on the sahi sourcecode, so it ignores invisible elements by default?
  • sbasba Members
    anyone?
  • narayannarayan Administrators
    Hi sba,

    We are working on this on high priority. We will be able to give you an answer by end of day. (We need a way to introduce this feature and still keep the older scripts running.)

    Regards,
    Narayan
  • narayannarayan Administrators
    Hi Stefan,

    From the April 4th release, we have support for identifying only visible elements.

    We have introduced an API: _setStrictVisibilityCheck

    Usage:
    _setStrictVisibilityCheck(true);
    // From now on, only elements which are visible will be
    // considered during Sahi's accessor identification.

    _setStrictVisibilityCheck(false);
    // Will now revert to original behavior of identifying hidden elements too.

    Please have a look at
    sencha_combobox.sah
    and
    strict_visible.sah
    in userdata/scripts/demo folder to see this API in action.

    The API are details are also available here: http://sahi.co.in/w/miscellaneous-apis

    Regards,
    Narayan
  • Its great news.... :)

    This will sort out lots of issue in easier way..

    Cheers,
Sign In or Register to comment.