com.meterware.httpunit

Class WebLink

public class WebLink extends FixedURLWebRequestSource

This class represents a link in an HTML page. Users of this class may examine the structure of the link (as a DOM), or create a WebRequest to simulate clicking on the link.

Author: Russell Gold Nested Class Summary classWebLink.Scriptable

Field Summary
static HTMLElementPredicateMATCH_CONTAINED_TEXT
Predicate to match part or all of a link's contained text.
static HTMLElementPredicateMATCH_ID
Predicate to match a link's ID.
static HTMLElementPredicateMATCH_NAME
Predicate to match a link's name.
static HTMLElementPredicateMATCH_TEXT
Predicate to match a link's text exactly.
static HTMLElementPredicateMATCH_URL_STRING
Predicate to match part or all of a link's URL string.
Method Summary
StringasText()
Returns the text value of this link.
WebResponseclick()
Submits a request as though the user had clicked on this link.
ScriptableDelegategetScriptableDelegate()
Returns the scriptable delegate.
StringgetText()
Returns the text value of this link.
StringgetURLString()
Returns the URL referenced by this link.
voidmouseOver()
Simulates moving the mouse over the link.

Field Detail

MATCH_CONTAINED_TEXT

public static final HTMLElementPredicate MATCH_CONTAINED_TEXT
Predicate to match part or all of a link's contained text. *

MATCH_ID

public static final HTMLElementPredicate MATCH_ID
Predicate to match a link's ID. *

MATCH_NAME

public static final HTMLElementPredicate MATCH_NAME
Predicate to match a link's name. *

MATCH_TEXT

public static final HTMLElementPredicate MATCH_TEXT
Predicate to match a link's text exactly. *

MATCH_URL_STRING

public static final HTMLElementPredicate MATCH_URL_STRING
Predicate to match part or all of a link's URL string. *

Method Detail

asText

public String asText()

Deprecated: as of 1.6, use #getText instead

Returns the text value of this link.

click

public WebResponse click()
Submits a request as though the user had clicked on this link. Will also fire the 'onClick' event if defined. If clicking results in submitting a request (that is, there is no 'onClick' event or it returns true, this method will return the result of that submission; otherwise, it will return the updated contents of the frame containing this link. Note that if an event updates a different frame that frame will not be returned by this method.

getScriptableDelegate

public ScriptableDelegate getScriptableDelegate()
Returns the scriptable delegate.

getText

public String getText()
Returns the text value of this link.

Since: 1.6

getURLString

public String getURLString()
Returns the URL referenced by this link. This may be a relative URL. It will not include any fragment identifier.

mouseOver

public void mouseOver()
Simulates moving the mouse over the link. Will fire the 'onMouseOver' event if defined.