Class WebRequestSource
java.lang.Object
com.meterware.httpunit.WebRequestSource
- All Implemented Interfaces:
HTMLElement, com.meterware.httpunit.protocol.ParameterCollection, ScriptingEventHandler
Base class for objects which can be clicked to generate new web requests.
- Author:
- Russell Gold
-
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidaddPresetParameter(String name, String value) Records a parameter defined by including it in the destination URL.booleanDeprecated.since 1.7 - use doEventScript insteadbooleandoEventScript(String eventScript) optional do the event if it's definedgetAttribute(String name) get the attribute value for the given nameprotected final WebResponseReturns the web response containing this request source.protected URLReturns the class associated with this request source.protected WebResponseprotected StringReturns a copy of the domain object model subtree associated with this entity.protected ElementReturns the actual DOM for this request source, not a copy.protected abstract StringReturns the fragment identifier for this request source, used to identifier an element within an HTML document.getFrame()Returns the frame containing this request source.protected HTMLPageReturns the HTMLPage associated with this request source.getID()Returns the ID associated with this request source.getName()Returns the name associated with this request source.getNode()Returns the DOM node underlying this element.Deprecated.as of 1.6, use #getFrameabstract String[]Returns an array containing the names of any parameters to be sent on a request based on this request source.abstract String[]getParameterValues(String name) Returns the values of the named parameter.Returns the scriptable delegate which can provide the scriptable delegate for this element.protected Stringget the relative URL for a weblink change spaces to %20abstract WebRequestCreates and returns a web request from this request source.Returns the scriptable delegate.Returns the tag name of this node.Returns the target for this request source.getText()Returns the text value of this block.getTitle()Returns the title associated with this request source.booleanhandleEvent(String eventName) handle the event with the given name by getting the attribute and then executing the eventScript for itbooleanisSupportedAttribute(String name) Returns true if this element may have an attribute with the specified name.protected final voidExtracts any parameters specified as part of the destination URL, calling addPresetParameter for each one in the order in which they are found.voidremoveAttribute(String name) remove the given attributevoidsetAttribute(String name, Object value) set the attribute with the given name to the given valueprotected voidsetDestination(String destination) protected voidsetTargetAttribute(String value) protected final WebResponsesubmitRequest(WebRequest request) Submits a request to the web client from which this request source was originally obtained.protected WebResponsesubmitRequest(String event, WebRequest request) submit the given event for the given requestMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface HTMLElement
newScriptableMethods inherited from interface com.meterware.httpunit.protocol.ParameterCollection
recordParameters
-
Method Details
-
getID
Returns the ID associated with this request source.- Specified by:
getIDin interfaceHTMLElement
-
getClassName
Returns the class associated with this request source.- Specified by:
getClassNamein interfaceHTMLElement
-
getName
Returns the name associated with this request source.- Specified by:
getNamein interfaceHTMLElement
-
getTitle
Returns the title associated with this request source.- Specified by:
getTitlein interfaceHTMLElement
-
getTarget
Returns the target for this request source. -
getPageFrame
Deprecated.as of 1.6, use #getFrameReturns the name of the frame containing this request source. -
getFrame
Returns the frame containing this request source. -
getFragmentIdentifier
Returns the fragment identifier for this request source, used to identifier an element within an HTML document. -
getDOMSubtree
Returns a copy of the domain object model subtree associated with this entity. -
getRequest
Creates and returns a web request from this request source. -
getParameterNames
Returns an array containing the names of any parameters to be sent on a request based on this request source. -
getParameterValues
-
getRelativeURL
get the relative URL for a weblink change spaces to %20- Returns:
- the relative URL as a string
-
getBaseURL
-
getDestination
-
setDestination
-
getElement
Returns the actual DOM for this request source, not a copy. -
getHTMLPage
Returns the HTMLPage associated with this request source.- Throws:
SAXException
-
loadDestinationParameters
protected final void loadDestinationParameters()Extracts any parameters specified as part of the destination URL, calling addPresetParameter for each one in the order in which they are found. -
submitRequest
protected WebResponse submitRequest(String event, WebRequest request) throws IOException, SAXException submit the given event for the given request- Parameters:
event-request-- Returns:
- the response for the submitted Request
- Throws:
IOExceptionSAXException
-
doEvent
Deprecated.since 1.7 - use doEventScript insteadhandle the event that has the given script attached by compiling the eventScript as a function and executing it- Specified by:
doEventin interfaceScriptingEventHandler- Parameters:
eventScript- - the script to use- Returns:
- true if the script is empty or the result of the script
-
doEventScript
optional do the event if it's defined- Specified by:
doEventScriptin interfaceScriptingEventHandler- Parameters:
eventScript- - the script to handle- Returns:
- whether the script was handled
-
handleEvent
Description copied from interface:ScriptingEventHandlerhandle the event with the given name by getting the attribute and then executing the eventScript for it- Specified by:
handleEventin interfaceScriptingEventHandler- Parameters:
eventName-- Returns:
- the result of doEventScript
-
getCurrentFrameContents
-
submitRequest
Submits a request to the web client from which this request source was originally obtained.- Throws:
IOExceptionSAXException
-
getBaseResponse
Returns the web response containing this request source. -
addPresetParameter
-
getAttribute
get the attribute value for the given name- Specified by:
getAttributein interfaceHTMLElement- Parameters:
name- - the name of the attribute to get
-
setAttribute
set the attribute with the given name to the given value- Specified by:
setAttributein interfaceHTMLElement- Parameters:
name- - the name of the attributevalue- - the value to use
-
removeAttribute
remove the given attribute- Specified by:
removeAttributein interfaceHTMLElement- Parameters:
name- - the name of the attribute to remove
-
isSupportedAttribute
Description copied from interface:HTMLElementReturns true if this element may have an attribute with the specified name.- Specified by:
isSupportedAttributein interfaceHTMLElement
-
getNode
Description copied from interface:HTMLElementReturns the DOM node underlying this element.- Specified by:
getNodein interfaceHTMLElement
-
getText
Returns the text value of this block.- Specified by:
getTextin interfaceHTMLElement
-
getTagName
Description copied from interface:HTMLElementReturns the tag name of this node.- Specified by:
getTagNamein interfaceHTMLElement
-
setTargetAttribute
-
getEmptyParameterValue
-
getScriptingHandler
Returns the scriptable delegate.- Specified by:
getScriptingHandlerin interfaceHTMLElement
-
getParentDelegate
Description copied from interface:HTMLElementReturns the scriptable delegate which can provide the scriptable delegate for this element.- Specified by:
getParentDelegatein interfaceHTMLElement
-