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.

Popup window search result selection

1701198117011981 Members
edited November -1 in Sahi - Open Source
Pls provide the quick solution for this one...

On the page, there is a search icon (button)...
on clicking this icon, a popup window comes... In this pop up window, user enter the search string and click on the search button...now the search result appears in the same pop up window...i need to select any one entry of this search result and then click on the submit button....Now this selected search result comes on the main page....

But when i am recording, everything is fine up to popup window and search....but it is not supporting the selection of search result...i.e. on playback, the code for selection of search result inside the popup window doesn't work...

Please provide the immediate support...

Thanks

Comments

  • I am pasting my code here, see if it helps you,

    _click(_link(<Your Search button>));
    //Note: <popup window name>-->Try to check the popup window name from the html source code of the pop up window.

    _popup(<popup window name>)._setSelected(_select(<serach text box in pop up window>), value);
    _popup(<popup window name>)._setValue(_textbox(<text box name>), Value);
    _popup(<popup window name>)._click(_radio(<radio button id>));
    _popup(<popup window name>)._click(_button("Select"));

    In my case once the sleect button is clicked, it will automatically close the pop up window and add the selected value in parent window. You could modify the script as per your requirment.
    Point here is if you are doing anything on popup window it has to be assoiciated with the popup window title.
  • I met the same question. After click OK, the selected search result will fill in back some value to main page. But now sometimes I just cannot choose the search result. That means "_click(_div($ChargeGroupName[0][0]));" does not work sometimes. Why? How can I get it resolved?

    _setValue(_textbox("chargeCode"), $ChargeGroupName[0][0]);
    _click(_button("Search"));
    _wait(5000);
    _click(_div($ChargeGroupName[0][0]));
    _click(_button("OK"));
  • I may know that "(_div($ChargeGroupName[0][0])" have multiple ones, so sahi could not identify the exactly one I want. So I just wanna can any way else to indentify the seach result, for instance, cell[0]?
  • Hi abby988,

    Can you let me know what $ChargeGroupName[0][0] contains?

    Regards
    Sumitra
  • Hi Sumitra,

    Actually it is the selecton content string in CSV file.
    var $ChargeGroupName = _readCSVFile("./datafile/ChargeGroup.csv");

    And I have resolved it by using _in API, that is
    _click(_div($ChargeGroupName[0][0] ,_in(_div(/.*searchResultGrid/))));

    Thanks to all.

    Regards,
    Abby
This discussion has been closed.