|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.gargoylesoftware.htmlunit.WebAssert
public final class WebAssert
Utility class which contains standard assertions for HTML pages.
Method Summary | |
---|---|
static void |
assertAllAccessKeyAttributesUnique(HtmlPage page)
Many HTML components can have an accesskey attribute which defines a hot key for keyboard navigation. |
static void |
assertAllIdAttributesUnique(HtmlPage page)
Verifies that all element IDs in the specified page are unique. |
static void |
assertAllTabIndexAttributesSet(HtmlPage page)
Many HTML elements are "tabbable" and can have a tabindex attribute that determines the order in which the components are navigated when pressing the tab key. |
static void |
assertElementNotPresent(HtmlPage page,
String id)
Verifies that the specified page does not contain an element with the specified ID. |
static void |
assertElementNotPresentByXPath(HtmlPage page,
String xpath)
Verifies that the specified page does not contain an element matching the specified XPath expression. |
static void |
assertElementPresent(HtmlPage page,
String id)
Verifies that the specified page contains an element with the specified ID. |
static void |
assertElementPresentByXPath(HtmlPage page,
String xpath)
Verifies that the specified page contains an element matching the specified XPath expression. |
static void |
assertFormNotPresent(HtmlPage page,
String name)
Verifies that the specified page does not contain a form with the specified name. |
static void |
assertFormPresent(HtmlPage page,
String name)
Verifies that the specified page contains a form with the specified name. |
static void |
assertInputContainsValue(HtmlPage page,
String name,
String value)
Verifies that the input element with the specified name on the specified page contains the specified value. |
static void |
assertInputDoesNotContainValue(HtmlPage page,
String name,
String value)
Verifies that the input element with the specified name on the specified page does not contain the specified value. |
static void |
assertInputNotPresent(HtmlPage page,
String name)
Verifies that the specified page does not contain an input element with the specified name. |
static void |
assertInputPresent(HtmlPage page,
String name)
Verifies that the specified page contains an input element with the specified name. |
static void |
assertLinkNotPresent(HtmlPage page,
String id)
Verifies that the specified page does not contain a link with the specified ID. |
static void |
assertLinkNotPresentWithText(HtmlPage page,
String text)
Verifies that the specified page does not contain a link with the specified text. |
static void |
assertLinkPresent(HtmlPage page,
String id)
Verifies that the specified page contains a link with the specified ID. |
static void |
assertLinkPresentWithText(HtmlPage page,
String text)
Verifies that the specified page contains a link with the specified text. |
static void |
assertTextNotPresent(HtmlPage page,
String text)
Verifies that the specified page does not contain the specified text. |
static void |
assertTextNotPresentInElement(HtmlPage page,
String text,
String id)
Verifies that the element on the specified page which matches the specified ID does not contain the specified text. |
static void |
assertTextPresent(HtmlPage page,
String text)
Verifies that the specified page contains the specified text. |
static void |
assertTextPresentInElement(HtmlPage page,
String text,
String id)
Verifies that the element on the specified page which matches the specified ID contains the specified text. |
static void |
assertTitleContains(HtmlPage page,
String titlePortion)
Verifies that the specified page's title contains the specified substring. |
static void |
assertTitleEquals(HtmlPage page,
String title)
Verifies that the specified page's title equals the specified expected title. |
static void |
assertTitleMatches(HtmlPage page,
String regex)
Verifies that the specified page's title matches the specified regular expression. |
static void |
notNull(String description,
Object object)
Assert that the specified parameter is not null. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static void assertTitleEquals(HtmlPage page, String title)
page
- the page to checktitle
- the expected titlepublic static void assertTitleContains(HtmlPage page, String titlePortion)
page
- the page to checktitlePortion
- the substring which the page title is expected to containpublic static void assertTitleMatches(HtmlPage page, String regex)
page
- the page to checkregex
- the regular expression that the page title is expected to matchpublic static void assertElementPresent(HtmlPage page, String id)
page
- the page to checkid
- the expected ID of an element in the pagepublic static void assertElementPresentByXPath(HtmlPage page, String xpath)
page
- the page to checkxpath
- the XPath expression which is expected to match an element in the pagepublic static void assertElementNotPresent(HtmlPage page, String id)
page
- the page to checkid
- the ID of an element which expected to not exist on the pagepublic static void assertElementNotPresentByXPath(HtmlPage page, String xpath)
page
- the page to checkxpath
- the XPath expression which is expected to not match an element in the pagepublic static void assertTextPresent(HtmlPage page, String text)
page
- the page to checktext
- the text to check forpublic static void assertTextPresentInElement(HtmlPage page, String text, String id)
page
- the page to checktext
- the text to check forid
- the ID of the element which is expected to contain the specified textpublic static void assertTextNotPresent(HtmlPage page, String text)
page
- the page to checktext
- the text to check forpublic static void assertTextNotPresentInElement(HtmlPage page, String text, String id)
page
- the page to checktext
- the text to check forid
- the ID of the element which is expected to not contain the specified textpublic static void assertLinkPresent(HtmlPage page, String id)
page
- the page to checkid
- the ID of the link which the page is expected to containpublic static void assertLinkNotPresent(HtmlPage page, String id)
page
- the page to checkid
- the ID of the link which the page is expected to not containpublic static void assertLinkPresentWithText(HtmlPage page, String text)
page
- the page to checktext
- the text which a link in the specified page is expected to containpublic static void assertLinkNotPresentWithText(HtmlPage page, String text)
page
- the page to checktext
- the text which a link in the specified page is not expected to containpublic static void assertFormPresent(HtmlPage page, String name)
page
- the page to checkname
- the expected name of a form on the pagepublic static void assertFormNotPresent(HtmlPage page, String name)
page
- the page to checkname
- the name of a form which should not exist on the pagepublic static void assertInputPresent(HtmlPage page, String name)
page
- the page to checkname
- the name of the input element to look forpublic static void assertInputNotPresent(HtmlPage page, String name)
page
- the page to checkname
- the name of the input element to look forpublic static void assertInputContainsValue(HtmlPage page, String name, String value)
page
- the page to checkname
- the name of the input element to checkvalue
- the value to check forpublic static void assertInputDoesNotContainValue(HtmlPage page, String name, String value)
page
- the page to checkname
- the name of the input element to checkvalue
- the value to check forpublic static void assertAllTabIndexAttributesSet(HtmlPage page)
Many HTML elements are "tabbable" and can have a tabindex attribute that determines the order in which the components are navigated when pressing the tab key. To ensure good usability for keyboard navigation, all tabbable elements should have the tabindex attribute set.
This method verifies that all tabbable elements have a valid value set for the tabindex attribute.
page
- the page to checkpublic static void assertAllAccessKeyAttributesUnique(HtmlPage page)
page
- the page to checkpublic static void assertAllIdAttributesUnique(HtmlPage page)
page
- the page to checkpublic static void notNull(String description, Object object)
description
- the description to pass into the NullPointerExceptionobject
- the object to check for null
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |