Package com.meterware.httpunit

# Class WebWindow

java.lang.Object
com.meterware.httpunit.WebWindow

public class WebWindow extends Object
A window managed by a `WebClient`.

Author:
  Russell Gold

## Method Summary

Modifier and Type
Method
Description
`void`
`close()`
Closes this window.
`WebClient`
`getClient()`
Returns the web client associated with this window.
`WebResponse`
`getCurrentPage()`
Returns the response representing the main page in this window.
`WebResponse`
`getFrameContents(String frameName)`
Returns the response associated with the specified frame name.
`String[]`
`getFrameNames()`
Returns the name of the currently active frames.
`String`
`getName()`
Returns the name of this window.
`WebResponse`
`getOpener()`
Returns the web response that contained the script which opened this window.
`WebResponse`
`getResource(WebRequest request)`
Returns the resource specified by the request.
`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.
`WebResponse`
`getResponse(String urlString)`
Submits a GET method request and returns a response.
`boolean`
`hasFrame(String frameName)`
Returns true if the specified frame name is defined in this window.
`boolean`
`isClosed()`
Returns true if this window has been closed.
`WebResponse`
`sendRequest(WebRequest request)`
Submits a web request and returns a response.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Method Details

### getClient

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

### isClosed

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

### close

public void close()
Closes this window.

### 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.

### getResponse

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

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

### sendRequest

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

Returns:
  the WebResponse or null
Throws:
  `IOException`
  `SAXException`

### getResponse

public WebResponse getResponse(WebRequest request) throws IOException, SAXException
Submits a web request and returns a response, using all state developed so far as stored in cookies as requested by the server. see patch [ 1155415 ] Handle redirect instructions which can lead to a loop

Returns:
  the WebResponse or null
Throws:
  `SAXException` - thrown if there is an error parsing the retrieved page
  `IOException`

### getResource

public WebResponse getResource(WebRequest request) throws IOException
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.

Throws:
  `IOException`

### getFrameNames

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

### hasFrame

public boolean hasFrame(String frameName)
Returns true if the specified frame name is defined 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.

### getCurrentPage

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