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 @ with your query.

Accessing a popup which was header located

PachatPachat Members
In a web sie, I generate a PDF inside a popup.
- If the generation succeeds, I header('Location:... to the generated file
- If the generation fails, I get an HTML page instead saying "Error #..."

The problem is that, once the popup is opened, and header('Location:... done, it looks like Sahi does not recongnize the popup anymore. I get :
Error in script: _popup("win2")._closeWindow();
Window/Domain not found:  popupNameFromStep=win2; derivedName=; windowName=; windowTitle=All projects; wasOpened=0; domain=
--Stopped Playback: FAILURE--
Here is the .sah
// _assertNotContainsText("ERROR #", _popup("win2").document.body);

Questions :

1- How is it possible to close the PopUp ?

2- To test if the PDF generation did not fail, the line
// _assertNotContainsText("ERROR #", _popup("win2").document.body);
should be uncommented. But how this line will behave when the PDF was in fact generated, creating a page with no "document.body". Should I use
in that case ? How ?

Just to mention that the code works pergect when genrating HTML instead of PDF.


  • Hi Pachat,

    Could you please try using:

    _popup("All Projects")._closeWindow(); and check if this solves your issue.

    If the above usage doesn't solve your issue,then kindly send the source code of the popup window to

  • Sumitra,

    Thank you for your advice.

    _popup("All Projects")._closeWindow() will not close the window,
    but this time, the script will continue on, and no error are raised,
    which is an acceptable behaviour, as it allows to see the result

    From the IDE, it stays open until closed manually.

    From a .BAT, it closes at the end at the same time as the main window,
    except when another instance of Firefox is open.
    In that case no window will close automatically.
    (This behaviour is the same when there is no pupup)
  • Hi Pachat,

    _popup("popupname")._closeWindow(); should be able to close the popoup window.

    Could you please send the screen shot and the source code of the popup.

  • agonagon Members
    edited July 2018
    @Sumitra what if the popup name can't be identified. pdf opening within a popup outside of sahi shows as (Untitled - Google Chrome). How do I close this one?
Sign In or Register to comment.