Class ScriptableDelegate
java.lang.Object
com.meterware.httpunit.scripting.ScriptableDelegate
- All Implemented Interfaces:
ScriptingEventHandler, ScriptingHandler
- Direct Known Subclasses:
FormControl.Scriptable, HTMLPage.Scriptable, WebForm.Scriptable, WebImage.Scriptable, WebLink.Scriptable, WebResponse.Scriptable
An interface for objects which will be accessible via scripting.
- Author:
- Russell Gold
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ScriptingEnginea dummy ScriptingEngine implementation -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbooleanDeprecated.since 1.7 - use doEventScript insteadbooleandoEventScript(String eventScript) Executes the specified scripted event.evaluateExpression(String urlString) Evaluates the specified javascript expression, returning its value.get(int index) Returns the value of the index property.Returns the value of the named property.protected ScriptableDelegate[]getDelegates(HTMLElement[] elements) booleanhandleEvent(String eventName) Executes the event Handler script for the specified event (such as onchange, onmousedown, onclick, onmouseup) if it is defined.Executes the specified script, returning any intended replacement text.voidSets the value of the named property.voidsetScriptEngine(ScriptingEngine scriptEngine) Specifies the scripting engine to be used.booleansupportsScriptLanguage(String language)
-
Field Details
-
NULL_SCRIPT_ENGINE
a dummy ScriptingEngine implementation
-
-
Constructor Details
-
ScriptableDelegate
public ScriptableDelegate()
-
-
Method Details
-
supportsScriptLanguage
- Specified by:
supportsScriptLanguagein interfaceScriptingHandler
-
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
Executes the specified scripted event.- Specified by:
doEventScriptin interfaceScriptingEventHandler- Parameters:
eventScript- - the eventScript to execute- Returns:
- true if the event has been handled.
-
handleEvent
Executes the event Handler script for the specified event (such as onchange, onmousedown, onclick, onmouseup) if it is defined.- Specified by:
handleEventin interfaceScriptingEventHandler- Parameters:
eventName- the name of the event for which a handler should be run.- Returns:
- whether the event with the given name was handled
-
runScript
Executes the specified script, returning any intended replacement text.- Specified by:
runScriptin interfaceScriptingHandler- Returns:
- the replacement text, which may be empty.
-
evaluateExpression
Evaluates the specified javascript expression, returning its value.- Specified by:
evaluateExpressionin interfaceScriptingHandler
-
clearCaches
public void clearCaches()- Specified by:
clearCachesin interfaceScriptingHandler
-
get
-
get
Returns the value of the index property. Will return null if the property does not exist. -
set
-
setScriptEngine
Specifies the scripting engine to be used. -
getScriptEngine
-
getScriptEngine
-
getDelegates
-