Package com.meterware.httpunit
Class WebWindow
- java.lang.Object
-
- com.meterware.httpunit.WebWindow
-
public class WebWindow extends java.lang.Object
A window managed by aWebClient
.- Author:
- Russell Gold
-
-
Method Summary
All Methods Instance Methods Concrete Methods 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(java.lang.String frameName)
Returns the response associated with the specified frame name.java.lang.String[]
getFrameNames()
Returns the name of the currently active frames.java.lang.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(java.lang.String urlString)
Submits a GET method request and returns a response.boolean
hasFrame(java.lang.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.
-
-
-
Method Detail
-
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 java.lang.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(java.lang.String urlString) throws java.io.IOException, org.xml.sax.SAXException
Submits a GET method request and returns a response.- Throws:
org.xml.sax.SAXException
- thrown if there is an error parsing the retrieved pagejava.io.IOException
-
sendRequest
public WebResponse sendRequest(WebRequest request) throws java.io.IOException, org.xml.sax.SAXException
Submits a web request and returns a response. This is an alternate name for the getResponse method.- Returns:
- the WebResponse or null
- Throws:
java.io.IOException
org.xml.sax.SAXException
-
getResponse
public WebResponse getResponse(WebRequest request) throws java.io.IOException, org.xml.sax.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:
org.xml.sax.SAXException
- thrown if there is an error parsing the retrieved pagejava.io.IOException
-
getResource
public WebResponse getResource(WebRequest request) throws java.io.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:
java.io.IOException
-
getFrameNames
public java.lang.String[] getFrameNames()
Returns the name of the currently active frames.
-
hasFrame
public boolean hasFrame(java.lang.String frameName)
Returns true if the specified frame name is defined in this window.
-
getFrameContents
public WebResponse getFrameContents(java.lang.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.
-
-