org.jboss.test.selenium.locator
Class XpathLocator

java.lang.Object
  extended by org.jboss.test.selenium.locator.AbstractLocator<T>
      extended by org.jboss.test.selenium.locator.AbstractElementLocator<XpathLocator>
          extended by org.jboss.test.selenium.locator.XpathLocator
All Implemented Interfaces:
CompoundableLocator<XpathLocator>, ElementLocator<XpathLocator>, ExtendedLocator<XpathLocator>, IterableLocator<XpathLocator>, Locator<XpathLocator>

public class XpathLocator
extends AbstractElementLocator<XpathLocator>
implements ExtendedLocator<XpathLocator>

Locates the element using XPath expression.

Version:
$Revision$
Author:
Lukas Fryc

Constructor Summary
XpathLocator(String xpath)
          Instantiates a new xpath locator.
 
Method Summary
 ExtendedLocator<XpathLocator> format(Object... args)
           
 Iterable<XpathLocator> getAllChildren()
          Gets the all children of element given by this locator
 Iterable<XpathLocator> getAllOccurrences()
          Gets the all occurrences of element given by this locator
 XpathLocator getChild(XpathLocator elementLocator)
          Gets a child of this locator by composing this locator with given elementLocator.
 Iterable<XpathLocator> getChildren(XpathLocator elementLocator)
          Gets the children given by locator composed from this locator and given elementLocator.
 XpathLocator getDescendant(XpathLocator elementLocator)
          Gets a descendant of this locator by composing this locator with given elementLocator.
 Iterable<XpathLocator> getDescendants(XpathLocator elementLocator)
          Gets all the descendants for this locator specified by composed locator from this locator and given elementLocator.
 ElementLocationStrategy getLocationStrategy()
          Returns the location strategy for this element
 XpathLocator getNthChildElement(int index)
          Gets the N-th child element of this locator.
 XpathLocator getNthOccurence(int index)
          Gets the N-th occurence of descendant for this locator's element
 
Methods inherited from class org.jboss.test.selenium.locator.AbstractElementLocator
getAttribute
 
Methods inherited from class org.jboss.test.selenium.locator.AbstractLocator
getAsString, getRawLocator, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jboss.test.selenium.locator.ElementLocator
getAttribute
 
Methods inherited from interface org.jboss.test.selenium.locator.Locator
getAsString, getRawLocator
 

Constructor Detail

XpathLocator

public XpathLocator(String xpath)
Instantiates a new xpath locator.

Parameters:
xpath - the xpath
Method Detail

getLocationStrategy

public ElementLocationStrategy getLocationStrategy()
Description copied from interface: Locator
Returns the location strategy for this element

Specified by:
getLocationStrategy in interface ElementLocator<XpathLocator>
Specified by:
getLocationStrategy in interface Locator<XpathLocator>
Returns:
the location strategy for this element

getNthChildElement

public XpathLocator getNthChildElement(int index)
Description copied from interface: IterableLocator
Gets the N-th child element of this locator.

Specified by:
getNthChildElement in interface IterableLocator<XpathLocator>
Parameters:
index - the index of the child subsequent to this locator
Returns:
the N-th child element of this locator

getNthOccurence

public XpathLocator getNthOccurence(int index)
Description copied from interface: IterableLocator
Gets the N-th occurence of descendant for this locator's element

Specified by:
getNthOccurence in interface IterableLocator<XpathLocator>
Parameters:
index - the index of the descendant of this locator
Returns:
the N-th occurence of descendant

getAllChildren

public Iterable<XpathLocator> getAllChildren()
Description copied from interface: IterableLocator
Gets the all children of element given by this locator

Specified by:
getAllChildren in interface IterableLocator<XpathLocator>
Returns:
the all children of element given by this locator

getAllOccurrences

public Iterable<XpathLocator> getAllOccurrences()
Description copied from interface: IterableLocator
Gets the all occurrences of element given by this locator

Specified by:
getAllOccurrences in interface IterableLocator<XpathLocator>
Returns:
the all occurrences of element given by this locator

getChildren

public Iterable<XpathLocator> getChildren(XpathLocator elementLocator)
Description copied from interface: IterableLocator
Gets the children given by locator composed from this locator and given elementLocator.

Specified by:
getChildren in interface IterableLocator<XpathLocator>
Parameters:
elementLocator - the locator for element for composition with this locator
Returns:
the children given by locator composed from this locator and elementLocator

getDescendants

public Iterable<XpathLocator> getDescendants(XpathLocator elementLocator)
Description copied from interface: IterableLocator
Gets all the descendants for this locator specified by composed locator from this locator and given elementLocator.

Specified by:
getDescendants in interface IterableLocator<XpathLocator>
Parameters:
elementLocator - the element locator, which should be added to this locator to specify this element's descendants
Returns:
the descendants of element given by composition of this locator and elementLocator

getChild

public XpathLocator getChild(XpathLocator elementLocator)
Description copied from interface: CompoundableLocator
Gets a child of this locator by composing this locator with given elementLocator.

Specified by:
getChild in interface CompoundableLocator<XpathLocator>
Parameters:
elementLocator - are added to this locator to compose new compount locator
Returns:
the composed locator for this locator with added elementLocator

getDescendant

public XpathLocator getDescendant(XpathLocator elementLocator)
Description copied from interface: CompoundableLocator
Gets a descendant of this locator by composing this locator with given elementLocator.

Specified by:
getDescendant in interface CompoundableLocator<XpathLocator>
Parameters:
elementLocator - are added to this locator to compose new compound locator
Returns:
the composed locator for this locator with added elementLocator

format

public ExtendedLocator<XpathLocator> format(Object... args)
Specified by:
format in interface ElementLocator<XpathLocator>
Specified by:
format in interface ExtendedLocator<XpathLocator>
Specified by:
format in interface Locator<XpathLocator>
Overrides:
format in class AbstractElementLocator<XpathLocator>


Copyright © 2011 JBoss, a division of Red Hat, Inc.. All Rights Reserved.