com.atlassian.confluence.it
Class ResponseXPath

java.lang.Object
  extended by com.atlassian.confluence.it.ResponseXPath

public class ResponseXPath
extends java.lang.Object

Lets you call the WebTester XPath functions without throwing assertion failed errors.


Constructor Summary
ResponseXPath()
           
 
Method Summary
static java.lang.String getElementAttributeValue(net.sourceforge.jwebunit.junit.WebTester webTester, java.lang.String elementXPath, java.lang.String attribute)
          Returns the value of an attribute on an element in the current response stored in the WebTester.
static java.lang.String getElementText(net.sourceforge.jwebunit.junit.WebTester webTester, java.lang.String elementXPath)
          Returns the inner text of an element in the current response stored in the WebTester.
static boolean hasElement(net.sourceforge.jwebunit.junit.WebTester webTester, java.lang.String elementXPath)
          Returns true if an element in the current response stored in the WebTester matches the given xpath, otherwise returns false.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResponseXPath

public ResponseXPath()
Method Detail

getElementAttributeValue

public static java.lang.String getElementAttributeValue(net.sourceforge.jwebunit.junit.WebTester webTester,
                                                        java.lang.String elementXPath,
                                                        java.lang.String attribute)
Returns the value of an attribute on an element in the current response stored in the WebTester. The element used is the first element specified by executing the xpath expression against the response document. Returns null if either the element or attribute does not exist.

Wraps WebTester.getElementAttributByXPath(String, String).

Parameters:
webTester - the web tester to call WebTester.getElementAttributByXPath(String, String) on, which must not be null
elementXPath - the xpath of the element to find
attribute - the name of the attribute whose value will be returned
Returns:
the value of the given attribute on the first element specified by the xpath expression

getElementText

public static java.lang.String getElementText(net.sourceforge.jwebunit.junit.WebTester webTester,
                                              java.lang.String elementXPath)
Returns the inner text of an element in the current response stored in the WebTester. The element used is the first element specified by executing the xpath expression against the response document. Returns null if either the element does not exist.

Wraps WebTester.getElementTextByXPath(String).

Parameters:
webTester - the web tester to call WebTester.getElementTextByXPath(String) on, which must not be null
elementXPath - the xpath of the element to find
Returns:
the text inside the first element specified by the xpath expression

hasElement

public static boolean hasElement(net.sourceforge.jwebunit.junit.WebTester webTester,
                                 java.lang.String elementXPath)
Returns true if an element in the current response stored in the WebTester matches the given xpath, otherwise returns false.

Wraps WebTester.assertElementPresentByXPath(String).

Parameters:
webTester - the web tester to call WebTester.getElementTextByXPath(String) on, which must not be null
elementXPath - the xpath of the element to find
Returns:
true if an element with the given xpath exists, otherwise false


Copyright © 2003-2009 Atlassian Pty Ltd. All Rights Reserved.