public class

XPathLocator

extends AbstractLocator
implements Locator
java.lang.Object
   ↳ com.atlassian.jira.functest.framework.locator.AbstractLocator
     ↳ com.atlassian.jira.functest.framework.locator.XPathLocator

Class Overview

A Locator that uses XPath to locate org.w3c.dom.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 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.

Summary

[Expand]
Inherited Fields
From class com.atlassian.jira.functest.framework.locator.AbstractLocator
Public Constructors
XPathLocator(WebTester tester, String xPathExpressionStr)
Locates org.w3c.dom.Node's using the specified net.sourceforge.jwebunit.WebTester
XPathLocator(Node startNode, String xPathExpressionStr)
Locates org.w3c.dom.Node's starting from the specified org.w3c.dom.Node
Public Methods
Node[] getNodes()
A Locator may return 0 nodes, 1 node or multiple nodes.
String toString()
[Expand]
Inherited Methods
From class com.atlassian.jira.functest.framework.locator.AbstractLocator
From class java.lang.Object
From interface com.atlassian.jira.functest.framework.locator.Locator

Public Constructors

public XPathLocator (WebTester tester, String xPathExpressionStr)

Locates org.w3c.dom.Node's using the specified net.sourceforge.jwebunit.WebTester

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

public XPathLocator (Node startNode, String xPathExpressionStr)

Locates org.w3c.dom.Node's starting from the specified org.w3c.dom.Node

Parameters
startNode the org.w3c.dom.Node to start at
xPathExpressionStr the xpath string
Throws
RuntimeException if the xPathExpressionStr cannot be compiled into valid XPATH

Public Methods

public Node[] getNodes ()

A Locator may return 0 nodes, 1 node or multiple nodes.

Returns
  • a non null array of Nodes that match, or a zero sized array of no matches are made

public String toString ()