Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, windows and java based applications. Get your 30 day free trial.

Discuss your Sahi Pro usage patterns, best practices, problems and solutions. Help others solve their problems and seek help from the community when needed. If you need specific support on your application, please email support @

How can I close a new browser window?

MagUiMagUi Members
edited November -1 in Sahi - Open Source

I have the following problem: I need to check that my system open a new browser window with certain information (a pdf file), but then, close this new window (because there is a lot of new browser intances that will be opened, and, eventually, IE crash). There is a way to do that?



  • narayannarayan Administrators

    This is a tricky problem.

    When the download happens on the same window, Sahi downloads the file to its tmp/download folder and returns a 204 response, so that the browser stays on the previous page.

    In this case a new window is opened and if it gets 204, the window stays blank (am I right?). Unfortunately, this also means that it does not have Sahi's code injected in the new window. So you cannot use something like _popup("xx")._closeWindow();

    I will have a look at this and see if I can send back a normal response with html such that you can call _popup("xx")._closeWindow(); in just your case.

    Please email me, to remind me to work on this. Also mention whether there is a pattern to the window titles of these opened pages.

  • Hi Narayan!

    Like you said, when the new windows is opened, stays blank. But the data that must be showed on that window is correctly saved on "download" folder, so I have no problem for obtain that data.

    I will email you right now. Thanks!
  • Hi Narayan,
    i have the same problem have you any solution for that?
  • i have a solution:-)

    install the firefox plugin:
    Tab mix plus and enable under "tab closing" the option:

    "Do not close window when closing last tab"
  • Is this issue solved?


  • Hi,

    I have a similar situation where a new popup window is opened for a file download with name as "Untitled - Google Chrome" and this window does not close when using _popup("/Untitled/")._closeWindow();
    Was this issue solved ? If so kindly post how it was handled. I see this is a very old thread so i am hoping some fix was given in the later versions.

  • I will have a look at this and see if I can send back a normal response with html such that you can call _popup("xx")._closeWindow(); in just your case.

Sign In or Register to comment.