com.meterware.httpunit

Class WebWindow

public class WebWindow extends Object

A window managed by a {@link com.meterware.httpunit.WebClient WebClient}.

Author: Russell Gold

Method Summary
voidclose()
Closes this window.
WebClientgetClient()
Returns the web client associated with this window.
WebResponsegetCurrentPage()
Returns the response representing the main page in this window.
WebResponsegetFrameContents(String frameName)
Returns the response associated with the specified frame name.
String[]getFrameNames()
Returns the name of the currently active frames.
StringgetName()
Returns the name of this window.
WebResponsegetOpener()
Returns the web response that contained the script which opened this window.
WebResponsegetResource(WebRequest request)
Returns the resource specified by the request.
WebResponsegetResponse(String urlString)
Submits a GET method request and returns a response.
WebResponsegetResponse(WebRequest request)
Submits a web request and returns a response, using all state developed so far as stored in cookies as requested by the server.
booleanhasFrame(String frameName)
Returns true if the specified frame name is defined in this window.
booleanisClosed()
Returns true if this window has been closed.
WebResponsesendRequest(WebRequest request)
Submits a web request and returns a response.

Method Detail

close

public void close()
Closes this window.

getClient

public WebClient getClient()
Returns the web client associated with this window.

getCurrentPage

public WebResponse getCurrentPage()
Returns the response representing the main page in this window.

getFrameContents

public WebResponse getFrameContents(String frameName)
Returns the response associated with the specified frame name. Throws a runtime exception if no matching frame is defined.

getFrameNames

public String[] getFrameNames()
Returns the name of the currently active frames.

getName

public String getName()
Returns the name of this window. Windows created through normal HTML or browser commands have empty names, but JavaScript can set the name. A name may be used as a target for a request.

getOpener

public WebResponse getOpener()
Returns the web response that contained the script which opened this window.

getResource

public WebResponse getResource(WebRequest request)
Returns the resource specified by the request. Does not update the window or load included framesets. May return null if the resource is a JavaScript URL which would normally leave the client unchanged.

getResponse

public WebResponse getResponse(String urlString)
Submits a GET method request and returns a response.

Throws: SAXException thrown if there is an error parsing the retrieved page

getResponse

public WebResponse getResponse(WebRequest request)
Submits a web request and returns a response, using all state developed so far as stored in cookies as requested by the server.

Throws: SAXException thrown if there is an error parsing the retrieved page

hasFrame

public boolean hasFrame(String frameName)
Returns true if the specified frame name is defined in this window.

isClosed

public boolean isClosed()
Returns true if this window has been closed.

sendRequest

public WebResponse sendRequest(WebRequest request)
Submits a web request and returns a response. This is an alternate name for the getResponse method.