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.

selecting div in a combo list?

gligogligo Members
edited November -1 in Sahi - Open Source
Hello,

I want to select one option from a combo list, where the options are divs. With _click(_div("yes")); works, but I want to specified exaclty which combo should i set, because it can be so, that more combos with same values appears...I dont want to use indexes [4], but anything with _near for ex.
_near(_label("Test:"))..or another way to specify the exact combo I need..but it does not find it...


The combo list looks like this:

<div id="ext-gen906" class="x-layer x-combo-list " style="position: absolute; z-index: 12005; visibility: visible; left: 117px; top: 521px; width: 158px; height: 60px; font-size: 12px;">
<div id="ext-gen907" class="x-combo-list-inner" style="width: 158px; height: 60px;">
<div class="x-combo-list-item ">none</div>
<div class="x-combo-list-item ">yes</div>
<div class="x-combo-list-item x-combo-selected">no</div>
</div>
</div>

Comments

  • narayannarayan Administrators
    Could you please check with this?

    _div("yes", _in(_div("/x-combo-list/", _near(_label("Test:")))))
  • gligogligo Members
    edited February 2011
    No, maybe this label is not available at all at this moment...can I use somhow the visilbility property? Because only this element has visibility: visible, because it's opened, otherwise is :hidden..
    With _div("yes", _in(_div("/x-combo-list/"))) only, the element also is undefined
  • The item is found so _div("yes"), _under(_div("/x-combo-list/")) ..but always the first combo containing this value will be set..if I can use the visibility, maybe I will find the necessary combo...
  • narayannarayan Administrators
    We will need to write our own function for it. Sahi does not have support for conditional filtering right now. We are having a release coming up, we will address this issue after this release. Mean while you could use this to get to a visible div
    <browser>
    function getVisibleDiv(s){
      for (var i=0; i<50; i++){
        var el = _sahi._div(s+"["+i+"]");
        if (!el) return null;
        if (_sahi._isVisible(el)) {
           return el;
        }
      }
    }
    </browser>
    
    _click(getVisibleDiv("yes"));
    

    Regards,
    Narayan
  • Narayan, thank you, now works perfect.
    By the way, can I ask about how is going with the Flex support?
    Many, many thanks!
This discussion has been closed.