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.

Lose access to parent window

lexlex Members
edited November -1 in Sahi - Open Source
First of all, thanks for a great tool.

My sahi script appears to loose track of the parent window. i.e. After the initial window opens a popup window, I can no longer access the original window (e.g. in order to navigate somewhere else). Can you help?

The original window is still open, but sahi can no longer seem to access it using the same handle.

Note I've substituted <<google main page>> for the actual URL as new users of this forum can't post links.

*** sahi script ***
_popup("IMSBase")._click(_button("IMSBase 開始"));
_popup("IMSBase")._navigateTo("<<google main page>>");

*** Log ***
_popup("IMSBase")._click(_button("IMSBase 開始")); at 2010/08/02 15:17:53
_popup("IMSBase")._navigateTo("<<google main page>>");
Window not found: popupNameFromStep=IMSBase; derivedName=JDIM; windowName=JDIM; windowTitle=IMSBase 医師調査系データログイン; wasOpened=1; at 2010/08/02 15:18:02
Stopping script

*** Section of initial page which opens the popup window ***
am = window.open("./COMMON/CMLGN01001.aspx?t=d", 'JDIM', "width=1024px,height=730px,menubar=no,scrollbars=1;");
am.location.replace("./COMMON/CMLGN01001.aspx");
if(am){
am.opener = window;
}

*** Environment ***
Browser: IE 6.0.2900
Sahi version: Build: 2010-06-11

Comments

  • lexlex Members
    I discovered what was wrong.

    Firstly, there's no need to access the parent window with the _popup() function. You can manipulate the main window by using _click(), _navigateTo() directly (_click() instead of popup("main")._click()).

    And another issue I had, not illustrated by the above test script, was that my application didn't allow more that one of these popup windows simultaneously. I had a loop which was doing a _click() to open the popup, performing some operations, closing the popup and then immediately opening the next popup as it started the next iteration of the loop. It appeared as if the _click() in the second iteration was silently failing.

    I found I needed a _wait(1000) after closing the popup to allow the next popup to open successfully.
Sign In or Register to comment.