com.atlassian.jira.functest.framework.locator
Class XPathLocator

java.lang.Object
  extended by com.atlassian.jira.functest.framework.locator.AbstractLocator
      extended by com.atlassian.jira.functest.framework.locator.XPathLocator
All Implemented Interfaces:
Locator

public class XPathLocator
extends AbstractLocator
implements Locator

A Locator that uses XPath to locate Node's

For more information on XPath look here:

http://www.w3.org/TR/xpath

For a tutorial on XPath look here:

http://www.w3schools.com/xpath/default.asp

http://www.zvon.org/xxl/XPathTutorial/General/examples.html

NOTE : Locators are one shot objects. A call to Locator.getNodes() should return the same Nodes every time it is called. Even if the underlying data source has changed (for example the WebTester page has changed) the Locator MUST return the same data.

Since:
v3.13

Nested Class Summary
 
Nested classes/interfaces inherited from class com.atlassian.jira.functest.framework.locator.AbstractLocator
AbstractLocator.LocatorTextOperation
 
Field Summary
 
Fields inherited from class com.atlassian.jira.functest.framework.locator.AbstractLocator
nodes, originalWebResponse, tester
 
Constructor Summary
XPathLocator(Node startNode, String xPathExpressionStr)
          Locates Node's starting from the specified Node
XPathLocator(net.sourceforge.jwebunit.WebTester tester, String xPathExpressionStr)
          Locates Node's using the specified WebTester
 
Method Summary
 Node[] getNodes()
          A Locator may return 0 nodes, 1 node or multiple nodes.
 String toString()
          A meaningful "debugging" representation of this Locator to help when test fail.
 
Methods inherited from class com.atlassian.jira.functest.framework.locator.AbstractLocator
allMatches, betterNode, containsNode, exists, getDOM, getHTML, getHTML, getNode, getNodesTextImpl, getNodeTextImpl, getRawText, getRawText, getText, getText, getWebResponse, hasNodes, iterator, toStringImpl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.atlassian.jira.functest.framework.locator.Locator
allMatches, exists, getHTML, getHTML, getNode, getRawText, getRawText, getText, getText, hasNodes, iterator
 

Constructor Detail

XPathLocator

public XPathLocator(net.sourceforge.jwebunit.WebTester tester,
                    String xPathExpressionStr)
Locates Node's using the specified WebTester

Parameters:
tester - the WebTester in play
xPathExpressionStr - the xpath string
Throws:
RuntimeException - if the xPathExpressionStr cannot be compiled into valid XPATH

XPathLocator

public XPathLocator(Node startNode,
                    String xPathExpressionStr)
Locates Node's starting from the specified Node

Parameters:
startNode - the Node to start at
xPathExpressionStr - the xpath string
Throws:
RuntimeException - if the xPathExpressionStr cannot be compiled into valid XPATH
Method Detail

getNodes

public Node[] getNodes()
Description copied from interface: Locator
A Locator may return 0 nodes, 1 node or multiple nodes.

Specified by:
getNodes in interface Locator
Returns:
a non null array of Nodes that match, or a zero sized array of no matches are made

toString

public String toString()
Description copied from interface: Locator
A meaningful "debugging" representation of this Locator to help when test fail.

Specified by:
toString in interface Locator
Overrides:
toString in class Object
Returns:
A meaningful "debugging" representation of this Locator to help when test fail.


Copyright © 2002-2014 Atlassian. All Rights Reserved.