01: // Copyright © 2002-2005 Canoo Engineering AG, Switzerland.
02: package com.canoo.webtest.steps.request;
03:
04: import com.canoo.webtest.engine.Context;
05: import com.canoo.webtest.steps.Step;
06: import com.gargoylesoftware.htmlunit.TopLevelWindow;
07:
08: /**
09: * Closes the current top level window.<p>
10: *
11: * @author Marc Guillemot
12: * @webtest.step category="Extension"
13: * name="closeWindow"
14: * description="Closes the current top level window.
15: * The content of the last previously opened window will become the current response."
16: */
17: public class CloseWindow extends Step {
18:
19: public void doExecute() throws Exception {
20: final Context context = getContext();
21:
22: final TopLevelWindow window = (TopLevelWindow) context
23: .getCurrentResponse().getEnclosingWindow()
24: .getTopWindow();
25: window.close();
26: }
27:
28: protected void verifyParameters() {
29: super.verifyParameters();
30: nullResponseCheck();
31: }
32: }
|