public abstract class AbstractLocator extends Object implements Locator
Locator
s fromModifier and Type | Class and Description |
---|---|
protected static interface |
AbstractLocator.LocatorTextOperation |
Modifier and Type | Field and Description |
---|---|
protected Node[] |
nodes |
protected com.meterware.httpunit.WebResponse |
originalWebResponse |
protected net.sourceforge.jwebunit.WebTester |
tester |
Modifier | Constructor and Description |
---|---|
protected |
AbstractLocator() |
protected |
AbstractLocator(net.sourceforge.jwebunit.WebTester tester) |
Modifier and Type | Method and Description |
---|---|
Iterable<LocatorEntry> |
allMatches()
Get all matches of this locator as an iterable collection of locator entries
|
protected Node |
betterNode(Node node) |
protected static boolean |
containsNode(Locator locator,
Node node) |
boolean |
exists()
Return true at least one element will be matches by this locator.
|
protected Document |
getDOM(net.sourceforge.jwebunit.WebTester tester)
Returns the DOM Document from the WebTester.
|
String |
getHTML()
Returns the HTML that a called to
Locator.getNodes() represent, including the top level nodes themselves. |
String |
getHTML(Node node)
Returns the HTML of the specified node.
|
Node |
getNode()
This convenience methods is the the equivalent of getNodes()[0] except when the number of nodes
found is zero, in which case it should return null.
|
protected String |
getNodesTextImpl(Node[] nodes,
AbstractLocator.LocatorTextOperation textOperation)
Called to get all the text or HTML of a set of
Node 's. |
protected String |
getNodeTextImpl(Node node,
AbstractLocator.LocatorTextOperation textOperation)
Called to get the test or HTML of an
Node |
String |
getRawText()
Returns the combined raw text of the Nodes that
getNodes() would return or empty string. |
String |
getRawText(Node node)
Returns the raw text of the specified Node.
|
String |
getText()
Returns the combined collapsed text of the Nodes that
getNodes() would return or empty string. |
String |
getText(Node node)
Returns the collapsed text of the specified Node.
|
protected com.meterware.httpunit.WebResponse |
getWebResponse(net.sourceforge.jwebunit.WebTester tester) |
boolean |
hasNodes()
This will return true if the Locator found some
Node 's. |
Iterator<LocatorEntry> |
iterator()
This will return a
Iterator that returns LocatorEntry objects |
protected String |
toStringImpl(String concreteImplementationName) |
protected net.sourceforge.jwebunit.WebTester tester
protected com.meterware.httpunit.WebResponse originalWebResponse
protected Node[] nodes
protected AbstractLocator()
protected AbstractLocator(net.sourceforge.jwebunit.WebTester tester)
public boolean exists()
Locator
public Node getNode()
Locator
public Iterator<LocatorEntry> iterator()
Locator
Iterator
that returns LocatorEntry
objectsiterator
in interface Locator
Iterator
that returns LocatorEntry
objectspublic Iterable<LocatorEntry> allMatches()
Locator
allMatches
in interface Locator
public boolean hasNodes()
Locator
Node
's. This is really a convenience method
for getNodes().length > 0protected Document getDOM(net.sourceforge.jwebunit.WebTester tester)
tester
- the WebTester in playpublic String getText()
Locator
getNodes()
would return or empty string.
NOTE : This text is the "COLLAPSED" text of the nodes, that is all the child Text
nodes
smooshed together to removed repeating whitespace.
public String getText(Node node)
Locator
getNodes()
would return.
NOTE : This text is the "COLLAPSED" text of the node, that is all the child Text
nodes
smooshed together to removed repeating whitespace.
public String getRawText()
Locator
getNodes()
would return or empty string.
NOTE : This text is the "RAW" text of the nodes, that is all the child Text
nodes
appended together with not whitespace removal at all.
getRawText
in interface Locator
public String getRawText(Node node)
Locator
getNodes()
would return.
NOTE : This text is the "RAW" text of the node, that is all the child Text
nodes
appended together with not whitespace removal at all.
getRawText
in interface Locator
node
- the node that we previously returned by a call to getNodes()public String getHTML()
Locator
Locator.getNodes()
represent, including the top level nodes themselves.public String getHTML(Node node)
Locator
getNodes()
would return.protected String getNodeTextImpl(Node node, AbstractLocator.LocatorTextOperation textOperation)
Node
node
- the NodetextOperation
- the type of text operationprotected String getNodesTextImpl(Node[] nodes, AbstractLocator.LocatorTextOperation textOperation)
Node
's. Makes a call
to AbstractLocator#getNodeHtmlImpl for each node and appends it.nodes
- the Nodes to get text fortextOperation
- the type of text operationprotected com.meterware.httpunit.WebResponse getWebResponse(net.sourceforge.jwebunit.WebTester tester)
Copyright © 2002-2015 Atlassian. All Rights Reserved.