Please note that Sahi's development and support teams do not actively monitor this. This is more a community forum. If you are a Sahi Pro user looking for commercial support, please email support @ sahipro.com with your query.

How to close a window which is not a popup

shamsham Members
edited 10:02AM in Sahi - Open Source
Hi All,

In one of my test cases I encountered a process which when clicked opens up a small window to display the progress.
Unfortunately it does not have a "close" button of any sort.
It only has a conventional 'x' at the right top of the window that is used to close the session.
How can i use SAHI to click that button.

when i tried to get the accessor for it, I get something like "x-tool x-tool-close x-tool-close-over", that cannot be used.
The only accessor i get for it is this _div("x-tool x-tool-close x-tool-close-over")

Any ideas on how to close such a window?

Comments

  • Hi Sham,

    _closeWindow() only works for popups.

    Ctrl+Hover on the small window and check if the elements are been identied with _popup("") prefixed to it. If so then you will be able to close that small window. If its not a popup then i dont think you would be able to close it through Sahi.

    Regards
    Smrithi
  • Hi Sham,

    Use _popup("popupname")._eval("top.close()");

    This might help you.

    Regards,
    Theeran.
  • tsivatsiva Members
    edited May 2012
    Hi Guys,
    I am also facing similar issue with one of my applications. Our application is using EXTJS 2.0 version and I was using IE9 browser.
    There was a Comments + button to openup a New comment window for writing a comment in it. On the New window i have Save and Close buttons. My requirement is either Save the comments that was written in the window by clicking the Save button or simply close the window by clicking Close button. I was trying to use either of the buttons but none of them work from Sahi. The same buttons work correctly outside Sahi.
    The new window was opened as EXT.Window from the application when i click on comments button. I was able to do assert on both the events and also able to record click action on those buttons. Until this point my script is running successfully, but only the problem is the opened window was neither saving the comments on Save action nor closing the window with close action. I have used the below commands and tried with some other options that was provided in the forums but none of them worked. I really appreciate if someone could help with this issue?

    _highlight(_button("x-btn-text[5]"));
    _assertExists(_button("x-btn-text[5]"));
    _assert(_isVisible(_button("x-btn-text[5]")));
    _assertEqual("Close", _getText(_button("x-btn-text[5]")));
    _assertContainsText("Close", _button("x-btn-text[5]"));

    _click(_button("x-btn-text[5]"));

    I tried the below options as well but of no use:
    var $temp;
    _popup("New Comment")._set($temp, __click(_button("Close[1]")));


    _window("New Comment").close();

    _selectWindow("New Comment");
    _click(_button("Close[2]"));
    _selectWindow();
  • Any update on this case guys?
Sign In or Register to comment.