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.

Dealing with popup window with sahi

amol.likhiteamol.likhite Members
edited November -1 in Sahi - Open Source
I am facing problem while dealing with popups.
We have Add Role button, on button click, system will open a new window where all the roles are displayed and user can select one of the Role from popup window and click on Ok button to redirect to main window. For this I have added the code but it doesn't wok.

_click(_span("Add Role")); //Click on Add role button
/* --Popup window -- */
_selectWindow("winConfirm"); // select popWindow
//Following action will performed on Popup window
_click(_link("add_1")); // Select the role from popup window
_click(_button("//button")); // will click on ok button
_selectWindow(); // select main window

Can anyone help me?
OS - Windows 7
Browser - Firefox
Sahi - Sahi pro 3.6.2

Comments

  • Hi amol.likhite,

    Can you let me know where exactly you are facing problem and what is the error message you are getting?

    Could you please share the URL?

    Also, try with other browsers.

    Regards
    Sumitra
  • When I play the recorded script, system is showing the following error :-

    _popup("winConfirm")._click(_link("add_1")); // Select the role from popup window
    Window/Domain not found: popupNameFromStep=winConfirm; derivedName=; windowName=; windowTitle=Central Learning Coffee - Crear Usuario; wasOpened=0; domain= at 12 Sep, 2011 3:30:07 PM

    bcoz of this system is not selecting the role from the popup window.
  • Hello Sumitra,

    After the changes suggested by you, I am geeting the same error.

    Regards,
    Amol
  • Hi amol.likhite,

    It should be :

    _selectWindow("Central Learning Coffee - Crear Usuario");

    instead of

    _selectWindow("winConfirm");

    Regards
    Sumitra
  • Hi Sumitra,

    It works. Thanks for de help.

    Regards,
    Amol
  • amol.likhiteamol.likhite Members
    edited September 2011
    Hi again,

    I have 1 problem related to Pop up window. How can I click on the particular check box from the popup window if following 3 values are present on the Pop up window.

    1. ABC
    2. DEF
    3. GHI

    Thanks in advance

    Regards,
    Amol
  • Hi amol.likhite,

    If its a check box then it should be:

    _click(_checkbox("ABC"));
    _click(_checkbox("DEF"));
    _click(_checkbox("GHI"));

    CTRL+Hover on the checkbox and check what the Accessor field displays and perform click on that.

    Regards
    Sumitra
  • amol.likhiteamol.likhite Members
    edited September 2011
    Thanks Sumitra, for quick response.

    The popup window which is opening has the checkbox which are generated dynamically. This checkbox are not staic one. I am facing this issue for this particular popup only. All other static popup pages working fine. CTRL+Hover on the checkbox is also not working in this case.

    Please help me to resolve this issue. Thanks in advance.
  • Hi amol.likhite,

    Can you please send the screenshot of the popup window which has the checkbox to support@sahi.co.in

    Regards
    Sumitra
  • Hi amol.likhite,

    Try using _near() API to click the checkbox.

    Here is an example which would help you to understand how to use _near() API:

    _check(_checkbox("cb",_near(_textarea("ta")))); Checks the given checkbox or radio element. If already checked, this API does not do anything

    _click(_checkbox("cb",_near(_textarea("ta")))); This will help you to click the checkbox,if clicked again will uncheck the checkbox.

    Let me know if this solves your issue.

    Regards
    Sumitra
  • amol.likhiteamol.likhite Members
    edited September 2011
    After the changes suggested by you, I am geeting the same error.

    I have added follwoing line in the script :-
    _click(_checkbox("add_1",_near(_textarea("Almuno"))));

    Note :- add_1 is the id of the checkbox.

    Regards,
    Amol
Sign In or Register to comment.