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.

auto complete select all in the list

edited November -1 in Sahi - Open Source
In our application , if we typed a letter like kor ,the name starts with kor was listing, i want to select the all the restaurants and locations.

this is inspect elecment

div id="Autocomplete_6e1b3" class="autocomplete" style="display: block; width: 484px; max-height: 400px; padding: 3px;">
<div class="selected" title="Koral">
<div class="category"> Restaurants </div>
<strong>Kor</strong>
al
</div>
<div title="Koramangala" class="">
<div class="category"> Locations </div>
<strong>Kor</strong>
amangala


iam using this code;--

_focus(_textbox("main_search_box"));
_setValue(_textbox("main_search_box"), "kor");


var $a=_collect("_title", "/./", _in(_div("Restaurants")));

for (var $i=0; $i<$a.length; $i+=1) {
_click($a[$i]);
_click(_button("SEARCH"));
var $b=_collect("_title", "/./", _in(_div("Locations")));

for (var $j=0; $j<$b.length; $j+=1) {
_click($b[$j]);
_call(history.back());
}
}


iam facing a problem fom yesterday....plzz help me


url:---justeat

Comments

  • hello any one help on this issue plzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
  • any one replay for this issue
  • sandeep... I am serious about this. Stop posting bullshit like
    hello any one help on this issue plzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
    this won't get you a faster reply. Be a little bit patient! You can't always expect an answer within a few hours.

    And if you would have looked at the html source, you might have found out, that there are no things like _title in your autocomplete. I would recommend you _collect the _strong forms. This way you can't differentiate between restaurants and locations in the autocomplete, but you will get everything.
    function testAutocomplete ($snippet) {
      _focus(_textbox("main_search_box"));
      _setValue(_textbox("main_search_box"), "$snippet);
      $b=_collect("_strong", "/"+$snippet+"/", _in(_div("/Autpocomplete/")));
      for (var $j=0; $j<$b.length; $j+=1) {
        _click($b[$j]);
        _click(_button("SEARCH"));
        _call(history.back());
       } 
    }
    
    
  • u sended code it is showing like --Stopped Playback: SUCCESS--

    _focus(_textbox("main_search_box"));
    _setValue(_textbox("main_search_box"), "kor");
    var $a=_collect("_div", "/./", _in(_div("autocomplete")));

    for (var $i=0; $i<$a.length; $i+=1) {
    _alert($a[$i].title);

    url:---justeat.in

    if we typed a letter like kor ,the name starts with kor was listing, i want to select the all the restaurants and locations one by one..............

    plzzz give the solution
  • use this
    function testAutocomplete ($snippet) {
      _focus(_textbox("main_search_box"));
      _setValue(_textbox("main_search_box"), $snippet);
      $b=_collect("_strong", /./, _in(_div(/autocomplete/)));
      for (var $j=0; $j<$b.length; $j+=1) {
        _click($b[$j]);
        _click(_button("SEARCH"));
        _call(history.back());
        _focus(_textbox("main_search_box"));
        _setValue(_textbox("main_search_box"), $snippet);
       } 
    }
    testAutocomplete ("kor")
    
Sign In or Register to comment.