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

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

public class CssLocator
extends AbstractLocator
implements Locator

A CSS locator that uses JSOUP org.jsoup.nodes.Document) under the covers

The CSS selectors are therefore the set that JSOUP can handle.

See {@link org.jsoup.select.Selector} for the supported CSS selectors

At present it is a subset of jQuery CSS support so be a bit careful with the more tricky selectors

Since:
v4.3

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
CssLocator(Node startNode, String cssSelector)
          Locates Node's starting from the specified Node

The start node can ONLY be a node given out previous by another CssLocator.

CssLocator(net.sourceforge.jwebunit.WebTester tester, String cssSelector)
          Locates Node's using the specified WebTester
 
Method Summary
protected  Node betterNode(Node node)
           
 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, 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

CssLocator

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

Parameters:
tester - the WebTester in play
cssSelector - the CSS selector string

CssLocator

public CssLocator(Node startNode,
                  String cssSelector)
Locates Node's starting from the specified Node

The start node can ONLY be a node given out previous by another CssLocator. It will throw and IllegalArgumentException if you give it any other type of Node.

Parameters:
startNode - the Node to start at.
cssSelector - the CSS selector string
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.

betterNode

protected Node betterNode(Node node)
Overrides:
betterNode in class AbstractLocator


Copyright © 2002-2012 Atlassian. All Rights Reserved.