com.meterware.httpunit.scripting

Class ScriptableDelegate

public abstract class ScriptableDelegate extends Object

An interface for objects which will be accessible via scripting.

Author: Russell Gold

Method Summary
booleandoEvent(String eventScript)
Executes the specified scripted event.
StringevaluateExpression(String urlString)
Evaluates the specified javascript expression, returning its value.
Objectget(String propertyName)
Returns the value of the named property.
Objectget(int index)
Returns the value of the index property.
protected ScriptableDelegate[]getDelegates(HTMLElement[] elements)
ScriptingEnginegetScriptEngine()
ScriptingEnginegetScriptEngine(ScriptableDelegate child)
StringrunScript(String language, String script)
Executes the specified script, returning any intended replacement text.
voidset(String propertyName, Object value)
Sets the value of the named property.
voidsetScriptEngine(ScriptingEngine scriptEngine)
Specifies the scripting engine to be used.
booleansupportsScript(String language)

Method Detail

doEvent

public boolean doEvent(String eventScript)
Executes the specified scripted event.

evaluateExpression

public String evaluateExpression(String urlString)
Evaluates the specified javascript expression, returning its value.

get

public Object get(String propertyName)
Returns the value of the named property. Will return null if the property does not exist.

get

public Object get(int index)
Returns the value of the index property. Will return null if the property does not exist.

getDelegates

protected ScriptableDelegate[] getDelegates(HTMLElement[] elements)

getScriptEngine

public ScriptingEngine getScriptEngine()

getScriptEngine

public ScriptingEngine getScriptEngine(ScriptableDelegate child)

runScript

public String runScript(String language, String script)
Executes the specified script, returning any intended replacement text.

Returns: the replacement text, which may be empty.

set

public void set(String propertyName, Object value)
Sets the value of the named property. Will throw a runtime exception if the property does not exist or cannot accept the specified value.

setScriptEngine

public void setScriptEngine(ScriptingEngine scriptEngine)
Specifies the scripting engine to be used.

supportsScript

public boolean supportsScript(String language)