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.

Click _select dont want to open my list

Fabrice BFabrice B Members
edited November -1 in Sahi - Open Source
Hi all,

I ve a site with _select elements. i can find options, i can select with _setSelected, but i just want to see on my browse the list which normally appears when i click on this element.

I tried

_click(_select(4));
_mouseDown(_select(4), true);

but nothing happens when i do that

Any idea ?

Thank you

Fabrice

Comments

  • Hi Fabrice,

    For normal dropdown _click(_select(4)) will not work, it will work only with _setSelected() API because it is a browser action API.

    The Actions which need to be performed on the browser are dispatched to the browser by the proxy.
    The remarkable thing about these Browser Action APIs, is that the parameter expressions
    passed to these APIs execute on the browser and not on the proxy.

    Regards
    Sumitra
  • Hi Sumitra,

    OK i understand, is there a bypass to be able to see the list of the select on my playback ?

    thank you so

    Fabrice
  • Hi Fabrice,

    You can have a look at below URL :

    http://sahi.co.in/forums/viewtopic.php?id=2992

    Regards
    Sumitra
  • Hi Sumitra,

    Thank you for this link it is interresting but a little too complex.

    Just what i want to do if it is possible is : with sahi example page http://sahi.co.in/demo/selectTest.htm

    On the browser page, When a click on _select("s1Id"), a list is open : i see this list. I just want to see the same thing when my playback script is launched.
    To be able to do that i must to found a way to click on this "select" in my script... simply

    Thank you so

    Fabrice
  • Hi Fabrice,

    If you are running a distributed script or a suite file then you wont be able to view the results on the controller. You can instead get the list of items from the dropdown list and perform assertion to check if the expected lists and the actual lists in the dropdown are the same.

    This is the way you can do it:
    _navigateTo("http://sahi.co.in/demo/selectTest.htm");
    <browser>
    function listElements() {
       var $items= new Array();
       $items = _select("s1Id").options;
       var $textElements = new Array();
       for(var $i=0; $i<$items.length; $i++){
           $textElements[$i] = _getText($items[$i]);
       }
    return $textElements;
    }
    </browser>
    var $expected = new Array("", "o1", "o2", "o3");
    _set($elements, listElements());
    _assertEqual($expected, $elements);
    

    Regards
    Sumitra
Sign In or Register to comment.