net.sourceforge.jwebunit.junit
Class WebTester

java.lang.Object
  extended by net.sourceforge.jwebunit.junit.WebTester

public class WebTester
extends java.lang.Object

Provides a high-level API for basic web application navigation and validation by providing JUnit assertions. It supports use of a property file for web resources (a la Struts), though a resource file for the app is not required.

Author:
Julien Henry, Jim Weaver, Wilkes Joiner

Constructor Summary
WebTester()
           
 
Method Summary
protected  boolean areFilesEqual(java.net.URL f1, java.net.URL f2)
           
 void assertButtonNotPresent(java.lang.String buttonId)
          Assert that a button with a given id is not present in the current window.
 void assertButtonNotPresentWithText(java.lang.String text)
          Assert that a button with a given text is not present in the current window.
 void assertButtonPresent(java.lang.String buttonId)
          Assert that a button with a given id is present in the current window.
A button can be the following HTML elements: button input button button
 void assertButtonPresentWithText(java.lang.String text)
          Assert that a button with a given text is present in the current window.
 void assertCheckboxNotPresent(java.lang.String checkboxName)
          Assert that a form checkbox with a given name is not present.
 void assertCheckboxNotPresent(java.lang.String checkboxName, java.lang.String checkboxValue)
          Assert that a given checkbox is not present.
 void assertCheckboxNotSelected(java.lang.String checkBoxName)
          Assert that a specific checkbox is not selected.
 void assertCheckboxNotSelected(java.lang.String checkBoxName, java.lang.String checkBoxValue)
          Assert that a specific checkbox is not selected.
 void assertCheckboxPresent(java.lang.String checkboxName)
          Assert that a form checkbox with a given name is present.
 void assertCheckboxPresent(java.lang.String checkboxName, java.lang.String checkboxValue)
          Assert that a given checkbox is present.
 void assertCheckboxSelected(java.lang.String checkBoxName)
          Assert that a specific checkbox is selected.
 void assertCheckboxSelected(java.lang.String checkBoxName, java.lang.String checkBoxValue)
          Assert that a specific checkbox is selected.
 void assertCommentNotPresent(java.lang.String comment)
          Assert that a comment is not present.
 void assertCommentPresent(java.lang.String comment)
          Assert that a comment is present.
 void assertCookiePresent(java.lang.String cookieName)
          Checks to see if a cookie is present in the response.
 void assertCookieValueEquals(java.lang.String cookieName, java.lang.String expectedValue)
          Check to see if a cookie has the given value.
 void assertCookieValueMatch(java.lang.String cookieName, java.lang.String regexp)
          Check to see if a cookie value match the given regexp.
 void assertDownloadedFileEquals(java.net.URL expected)
          Download the current page (or file) and compare it with the given file.
 void assertElementNotPresent(java.lang.String anID)
          Assert that an element with a given id is not present.
 void assertElementNotPresentByXPath(java.lang.String xpath)
          Assert that an element with a given xpath is not present.
 void assertElementPresent(java.lang.String anID)
          Assert that an element with a given id is present.
 void assertElementPresentByXPath(java.lang.String xpath)
          Assert that an element with a given xpath is present.
 void assertFormElementEmpty(java.lang.String formElementName)
          Deprecated. use an explicit testing method, e.g. setTextField(String, String) or setHiddenField(String, String)
 void assertFormElementEquals(java.lang.String formElementName, java.lang.String expectedValue)
          Deprecated. use an explicit testing method, e.g. assertTextFieldEquals(String, String)
 void assertFormElementMatch(java.lang.String formElementName, java.lang.String regexp)
          Assert that a specific form element matches an expected regexp.
 void assertFormElementNotPresent(java.lang.String formElementName)
          Assert that a form input element with a given name is not present.
 void assertFormElementPresent(java.lang.String formElementName)
          Assert that a form input element with a given name is present.
 void assertFormNotPresent()
          Assert that there is not a form present.
 void assertFormNotPresent(java.lang.String nameOrID)
          Assert that there is not a form with the specified name or id present.
 void assertFormPresent()
          Assert that there is a form present.
 void assertFormPresent(java.lang.String nameOrID)
          Assert that there is a form with the specified name or id present.
 void assertFramePresent(java.lang.String frameNameOrId)
          Assert that a frame with the given name or ID is present.
 void assertHeaderEquals(java.lang.String name, java.lang.String value)
          Assert a header is equal to a particular value.
 void assertHeaderMatches(java.lang.String name, java.lang.String regexp)
          Assert a header matches a particular pattern.
 void assertHeaderNotPresent(java.lang.String name)
          Assert a header is NOT present.
 void assertHeaderPresent(java.lang.String name)
          Assert a header is present.
 void assertHiddenFieldPresent(java.lang.String formElementName, java.lang.String expectedValue)
          Assert that an input hidden element with name formElementName has the expectedValue value.
 void assertImagePresent(java.lang.String imageSrc, java.lang.String imageAlt)
          Assert there is at least one image in the page with given src and (optional) alt attributes.
 void assertImagePresentPartial(java.lang.String partialImageSrc, java.lang.String partialImageAlt)
          Assert there is at least one image in the page with given partial src and (optional) partial alt attributes.
 void assertImageValid(java.lang.String imageSrc, java.lang.String imageAlt)
           
 void assertImageValidAndStore(java.lang.String imageSrc, java.lang.String imageAlt, java.io.File out)
          Asserts that the image with the given src and alt attribute values exist in the page and is an actual reachable image, then saves it as png with the given file name.
 void assertKeyInTable(java.lang.String tableSummaryOrId, java.lang.String key)
          Assert that the value of a given web resource is present in a specific table.
 void assertKeyInTable(java.lang.String tableSummaryOrId, java.lang.String key, java.lang.Object[] args)
          Assert that the value of a given web resource is present in a specific table.
 void assertKeyNotInTable(java.lang.String tableSummaryOrId, java.lang.String key)
          Assert that the value of a given web resource is not present in a specific table.
 void assertKeyNotPresent(java.lang.String key)
          Assert that a web resource's value is not present.
 void assertKeyNotPresent(java.lang.String key, java.lang.Object[] args)
          Assert that a web resource's formatted value is not present.
 void assertKeyPresent(java.lang.String key)
          Assert that a web resource's value is present.
 void assertKeyPresent(java.lang.String key, java.lang.Object[] args)
          Assert that a web resource's value (with formatting) is present
 void assertKeysInTable(java.lang.String tableSummaryOrId, java.lang.String[] keys)
          Assert that the values of a set of web resources are all present in a specific table.
 void assertKeysInTable(java.lang.String tableSummaryOrId, java.lang.String[] keys, java.lang.Object[][] args)
          Assert that the values of a set of web resources are all present in a specific table.
 void assertLabeledFieldEquals(java.lang.String id, java.lang.String fieldText)
          Assert that a labeled field exists (for the given ID) and the field that it labels equals the given text
 void assertLabelMatches(java.lang.String regexp)
          Assert a label exists.
 void assertLabelPresent(java.lang.String id)
          Assert a label for a given ID exists.
 void assertLinkNotPresent(java.lang.String linkId)
          Assert that no link with the given id is present in the response.
 void assertLinkNotPresentWithExactText(java.lang.String linkText)
          Assert that no link containing the Exact text is present.
 void assertLinkNotPresentWithExactText(java.lang.String linkText, int index)
          Assert that no link containing the Exact text is present.
 void assertLinkNotPresentWithImage(java.lang.String imageFileName)
          Assert that a link containing a specified image is not present.
 void assertLinkNotPresentWithText(java.lang.String linkText)
          Assert that no link containing the supplied text is present.
 void assertLinkNotPresentWithText(java.lang.String linkText, int index)
          Assert that no link containing the supplied text is present.
 void assertLinkPresent(java.lang.String linkId)
          Assert that a link with a given id is present in the response.
 void assertLinkPresentWithExactText(java.lang.String linkText)
          Assert that a link containing the Exact text is present.
 void assertLinkPresentWithExactText(java.lang.String linkText, int index)
          Assert that a link containing the Exact text is present.
 void assertLinkPresentWithImage(java.lang.String imageFileName)
          Assert that a link containing a specified image is present.
 void assertLinkPresentWithText(java.lang.String linkText)
          Assert that a link containing the supplied text is present.
 void assertLinkPresentWithText(java.lang.String linkText, int index)
          Assert that a link containing the supplied text is present.
 void assertMatch(java.lang.String regexp)
          Assert that supplied regexp is matched in the text of a page.
 void assertMatch(java.lang.String regexp, java.lang.String text)
          Assert a given string matches a given regular expression.
 void assertMatch(java.lang.String message, java.lang.String regexp, java.lang.String text)
          Assert a given string matches a given regular expression.
 void assertMatchInElement(java.lang.String elementID, java.lang.String regexp)
          Assert that a given element matches a specific regexp.
 void assertMatchInTable(java.lang.String tableSummaryNameOrId, java.lang.String regexp)
          Assert that supplied regexp is matched in a specific table.
 void assertMatchInTable(java.lang.String tableSummaryOrId, java.lang.String[] regexp)
          Assert that a set of regexp values are all matched in a specific table.
 void assertNoMatch(java.lang.String regexp)
          Assert that supplied regexp is not present.
 void assertNoMatchInElement(java.lang.String elementID, java.lang.String regexp)
          Assert that a given element does not match a specific regexp.
 void assertNoMatchInTable(java.lang.String tableSummaryNameOrId, java.lang.String regexp)
          Assert that supplied regexp is not present in a specific table.
 void assertNoMatchInTable(java.lang.String tableSummaryNameOrId, java.lang.String[] regexp)
          Assert that none of a set of regexp values are present in a specific table.
 void assertNotMatch(java.lang.String regexp, java.lang.String text)
          Assert a given string does not match a given regular expression.
 void assertNotMatch(java.lang.String message, java.lang.String regexp, java.lang.String text)
          Assert a given string does not match a given regular expression.
 void assertRadioOptionNotPresent(java.lang.String name, java.lang.String radioOption)
          Assert that a specific option is not present in a radio group.
 void assertRadioOptionNotSelected(java.lang.String name, java.lang.String radioOption)
          Assert that a specific option is not selected in a radio group.
 void assertRadioOptionPresent(java.lang.String name, java.lang.String radioOption)
          Assert that a specific option is present in a radio group.
 void assertRadioOptionSelected(java.lang.String name, java.lang.String radioOption)
          Assert that a specific option is selected in a radio group.
 void assertResetButtonNotPresent()
          Assert that no reset button is present in the current form.
A reset button can be the following HTML elements: reset input reset button
 void assertResetButtonNotPresent(java.lang.String buttonName)
          Assert that a reset button with a given name is not present.
A reset button can be the following HTML elements: reset input reset button
 void assertResetButtonPresent()
          Assert that a reset button is present.
 void assertResetButtonPresent(java.lang.String buttonName)
          Assert that a reset button with a given name is present.
A reset button can be the following HTML elements: reset input reset button
 void assertResponseCode(int status)
          Assert that the page response has a particular code.
 void assertResponseCodeBetween(int lower, int higher)
          Assert that the page response has a particular code between lower and higher (lower <= status <= higher).
 void assertSelectedOptionEquals(java.lang.String selectName, int index, java.lang.String option)
          Assert that the label of the current selected option matches the provided value in the Nth select element with the specified name.
 void assertSelectedOptionEquals(java.lang.String selectName, java.lang.String optionLabel)
          Assert that the label of the current selected option matches the provided value.
 void assertSelectedOptionMatches(java.lang.String selectName, int index, java.lang.String regexp)
          Assert that the label of the current selected option matches the provided regular expression in the Nth select element with the specified name.
 void assertSelectedOptionMatches(java.lang.String selectName, java.lang.String regexp)
          Assert that the label of the current selected option matches the provided regular expression value.
 void assertSelectedOptionsEqual(java.lang.String selectName, int index, java.lang.String[] labels)
          Assert that the currently selected display label(s) of a select box matches given label(s).
 void assertSelectedOptionsEqual(java.lang.String selectName, java.lang.String[] labels)
          Assert that the currently selected display label(s) of a select box matches given label(s).
 void assertSelectedOptionsMatch(java.lang.String selectName, int index, java.lang.String[] regexps)
          Assert that the currently selected display value(s) of a select box matches a given value(s).
 void assertSelectedOptionsMatch(java.lang.String selectName, java.lang.String[] regexps)
          Assert that the currently selected display value(s) of a select box matches a given value(s).
 void assertSelectedOptionValueEquals(java.lang.String selectName, int index, java.lang.String value)
          Assert that the currently selected value of a select box matches given value.
 void assertSelectedOptionValueEquals(java.lang.String selectName, java.lang.String value)
          Assert that the currently selected value of a select box matches given value.
 void assertSelectedOptionValuesEqual(java.lang.String selectName, int index, java.lang.String[] values)
          Assert that the currently selected value(s) of the Nth select box with the specified name matches given value(s).
 void assertSelectedOptionValuesEqual(java.lang.String selectName, java.lang.String[] values)
          Assert that the currently selected value(s) of a select box matches given value(s).
 void assertSelectOptionNotPresent(java.lang.String selectName, int index, java.lang.String optionLabel)
          Assert that a specific option is not present in a select box.
 void assertSelectOptionNotPresent(java.lang.String selectName, java.lang.String optionLabel)
          Assert that a specific option is not present in a select box.
 void assertSelectOptionPresent(java.lang.String selectName, int index, java.lang.String optionLabel)
          Assert that a specific option is present in the Nth select box (by label).
 void assertSelectOptionPresent(java.lang.String selectName, java.lang.String optionLabel)
          Assert that a specific option is present in a select box (by label).
 void assertSelectOptionsEqual(java.lang.String selectName, int index, java.lang.String[] expectedOptions)
          Assert that the display values of the Nth select element's options match a given array of strings.
 void assertSelectOptionsEqual(java.lang.String selectName, java.lang.String[] expectedOptions)
          Assert that the display values of a select element's options match a given array of strings.
 void assertSelectOptionsNotEqual(java.lang.String selectName, int index, java.lang.String[] expectedOptions)
          Assert that the display values of the Nth select element's options do not match a given array of strings.
 void assertSelectOptionsNotEqual(java.lang.String selectName, java.lang.String[] expectedOptions)
          Assert that the display values of a select element's options do not match a given array of strings.
 void assertSelectOptionsPresent(java.lang.String selectName, int index, java.lang.String[] optionLabels)
          Assert that given options are present in the Nth select box (by label).
 void assertSelectOptionsPresent(java.lang.String selectName, java.lang.String[] optionLabels)
          Assert that given options are present in a select box (by label).
 void assertSelectOptionValueNotPresent(java.lang.String selectName, int index, java.lang.String optionValue)
          Assert that a specific option value is not present in a select box.
 void assertSelectOptionValueNotPresent(java.lang.String selectName, java.lang.String optionValue)
          Assert that a specific option value is not present in a select box.
 void assertSelectOptionValuePresent(java.lang.String selectName, int index, java.lang.String optionValue)
          Assert that a specific option is present in the Nth select box (by value).
 void assertSelectOptionValuePresent(java.lang.String selectName, java.lang.String optionValue)
          Assert that a specific option is present in a select box (by value).
 void assertSelectOptionValuesEqual(java.lang.String selectName, int index, java.lang.String[] expectedValues)
          Assert that the values of the Nth select element's options match a given array of strings.
 void assertSelectOptionValuesEqual(java.lang.String selectName, java.lang.String[] expectedValues)
          Assert that the values of a select element's options match a given array of strings.
 void assertSelectOptionValuesNotEqual(java.lang.String selectName, int index, java.lang.String[] optionValues)
          Assert that the values of the Nth select element's options do not match a given array of strings.
 void assertSelectOptionValuesNotEqual(java.lang.String selectName, java.lang.String[] optionValues)
          Assert that the values of a select element's options do not match a given array of strings.
 void assertSelectOptionValuesPresent(java.lang.String selectName, int index, java.lang.String[] optionValues)
          Assert that given options are present in the Nth select box (by value).
 void assertSelectOptionValuesPresent(java.lang.String selectName, java.lang.String[] optionValues)
          Assert that given options are present in a select box (by value).
 void assertSubmitButtonNotPresent()
          Assert that no submit button is present in the current form.
 void assertSubmitButtonNotPresent(java.lang.String buttonName)
          Assert that a submit button with a given name is not present.
 void assertSubmitButtonPresent()
          Assert that a submit button is present.
 void assertSubmitButtonPresent(java.lang.String buttonName)
          Assert that a submit button with a given name is present.
 void assertSubmitButtonPresent(java.lang.String buttonName, java.lang.String buttonValue)
          Assert that a submit button with a given name and value is present.
 void assertTableEquals(java.lang.String tableSummaryNameOrId, java.lang.String[][] expectedCellValues)
          Assert that a specific table matches a matrix of supplied text values.
 void assertTableEquals(java.lang.String tableSummaryNameOrId, Table expectedTable)
          Assert that a specific table matches an ExpectedTable.
 void assertTableMatch(java.lang.String tableSummaryOrId, java.lang.String[][] expectedCellValues)
          Assert that a specific table matches a matrix of supplied regexps.
 void assertTableMatch(java.lang.String tableSummaryOrId, Table expectedTable)
          Assert that a specific table matches an ExpectedTable.
 void assertTableNotPresent(java.lang.String tableSummaryNameOrId)
          Assert that a table with a given summary or id value is not present.
 void assertTablePresent(java.lang.String tableSummaryNameOrId)
          Assert that a table with a given summary or id value is present.
 void assertTableRowCountEquals(java.lang.String tableSummaryNameOrId, int expectedRowCount)
          Assert that the number of rows for a specific table equals expected value.
 void assertTableRowsEqual(java.lang.String tableSummaryNameOrId, int startRow, java.lang.String[][] expectedTable)
          Assert that a range of rows for a specific table matches a matrix of supplied text values.
 void assertTableRowsEqual(java.lang.String tableSummaryNameOrId, int startRow, Table expectedTable)
          Assert that a range of rows for a specific table matches a matrix of supplied text values.
 void assertTableRowsMatch(java.lang.String tableSummaryOrId, int startRow, java.lang.String[][] expectedTable)
          Assert that a range of rows for a specific table matches a matrix of supplied regexps.
 void assertTableRowsMatch(java.lang.String tableSummaryOrId, int startRow, Table expectedTable)
          Assert that a range of rows for a specific table matches a matrix of supplied regexps.
 void assertTextFieldEquals(java.lang.String formElementName, java.lang.String expectedValue)
          Assert that an input text element with name formElementName has the expectedValue value.
 void assertTextInElement(java.lang.String elementID, java.lang.String text)
          Assert that a given element contains specific text.
 void assertTextInTable(java.lang.String tableSummaryNameOrId, java.lang.String text)
          Assert that supplied text is present in a specific table.
 void assertTextInTable(java.lang.String tableSummaryOrId, java.lang.String[] text)
          Assert that a set of text values are all present in a specific table.
 void assertTextNotInElement(java.lang.String elementID, java.lang.String text)
           
 void assertTextNotInTable(java.lang.String tableSummaryNameOrId, java.lang.String text)
          Assert that supplied text is not present in a specific table.
 void assertTextNotInTable(java.lang.String tableSummaryNameOrId, java.lang.String[] text)
          Assert that none of a set of text values are present in a specific table.
 void assertTextNotPresent(java.lang.String text)
          Assert that supplied text is not present.
 void assertTextPresent(java.lang.String text)
          Assert that supplied text is present.
 void assertTitleEquals(java.lang.String title)
          Assert title of current html page in conversation matches an expected value.
 void assertTitleEqualsKey(java.lang.String titleKey)
          Assert title of current html page matches the value of a specified web resource.
 void assertTitleEqualsKey(java.lang.String titleKey, java.lang.Object[] args)
          Assert title of current page matches formatted message resource
 void assertTitleMatch(java.lang.String regexp)
          Assert title of current html page in conversation matches an expected regexp.
 void assertTitleNotSame(java.lang.String title)
          Assert title of current html page in conversation is not equal to another value.
 void assertWindowCountEquals(int windowCount)
          Assert that the number of opened windows equals given value.
 void assertWindowPresent(int windowID)
          Assert that a window with the given ID is open.
 void assertWindowPresent(java.lang.String windowName)
          Assert that a window with the given name is open.
 void assertWindowPresentWithTitle(java.lang.String title)
          Assert that at least one window with the given title is open.
 void beginAt(java.lang.String aRelativeURL)
          Begin conversation at a URL absolute or relative to base URL.
 void checkCheckbox(java.lang.String checkBoxName)
          Select a specified checkbox.
 void checkCheckbox(java.lang.String checkBoxName, java.lang.String value)
          Select a specified checkbox.
 void clickButton(java.lang.String buttonId)
          Click the button with the given id.
 void clickButtonWithText(java.lang.String buttonValueText)
          Clicks a button with text of the value attribute.
 void clickElementByXPath(java.lang.String xpath)
          Click element with given xpath.
 void clickLink(java.lang.String linkId)
          Navigate by selection of a link with given id.
 void clickLinkWithExactText(java.lang.String linkText)
          Navigate by selection of a link with the exact given text.
 void clickLinkWithExactText(java.lang.String linkText, int index)
          Navigate by selecting Nth link with the exact given text.
 void clickLinkWithImage(java.lang.String imageFileName)
          Navigate by selection of a link with a given image.
 void clickLinkWithText(java.lang.String linkText)
          Navigate by selection of a link containing given text.
 void clickLinkWithText(java.lang.String linkText, int index)
          Navigate by selecting Nth link containing given text.
 void clickRadioOption(java.lang.String radioGroup, java.lang.String radioOption)
          Clicks a radio option.
 void closeBrowser()
          Close the current conversation.
 void closeWindow()
          Close the current window.
 void dumpCookies()
          Print all the cookies to stdout.
 void dumpHtml()
          Deprecated. Use getPageSource()
 void dumpHtml(java.io.PrintStream stream)
          Deprecated. Use getPageSource()
 void dumpTable(java.lang.String tableNameOrId)
          Dump the table as the 2D array that is used for assertions - for debugging purposes.
 void dumpTable(java.lang.String tableNameOrId, java.io.PrintStream stream)
          Dump the table as the 2D array that is used for assertions - for debugging purposes.
 java.util.Map<java.lang.String,java.lang.String> getAllHeaders()
          Get all response headers.
 java.util.List<java.lang.String> getComments()
          Get all the comments in a document, as a list of strings.
 ITestingEngine getDialog()
          Deprecated. You should not use plugin specific functionality. Please ask for a new core feature instead.
 java.lang.String getElementAttributByXPath(java.lang.String xpath, java.lang.String attribute)
          Deprecated. Use getElementAttributeByXPath(String, String)
 java.lang.String getElementAttributeByXPath(java.lang.String xpath, java.lang.String attribute)
          Get the attribute value of the given element.
 IElement getElementById(java.lang.String id)
          Get an element for a particular ID.
 IElement getElementByXPath(java.lang.String xpath)
          Get an element for a particular xpath.
 java.util.List<IElement> getElementsByXPath(java.lang.String xpath)
          Get elements for a particular xpath.
 java.lang.String getElementTextByXPath(java.lang.String xpath)
          Get text of the given element.
 java.util.List<IElement> getFieldsForLabel(IElement label)
          Get all the fields of type input, textarea or select that are referenced or contained in a particular label.
 java.lang.String getFormElementValue(java.lang.String formElementName)
          Deprecated. Use getElementAttributeByXPath(String, String)
 java.lang.String getHeader(java.lang.String name)
          Get a particular header value.
 java.awt.Image getImage(java.lang.String imageSrc, java.lang.String imageAlt)
           
 java.lang.String getLabeledFieldValue(java.lang.String identifier, IElement label)
          Get the current value of a given labelled field.
 java.lang.String getMessage(java.lang.String key)
          Return the value of a web resource based on its key.
 java.lang.String getMessage(java.lang.String key, java.lang.Object[] args)
          Return the value of a web resource based on its key, using MessageFormat to perform parametric substitution with formatting.
 java.lang.String getPageSource()
          Get the source of the HTML page (like in a real browser), or HTTP body for a non HTML content.
 java.lang.String getServerResponse()
          Get the last data sent by the server.
 java.lang.String getServeurResponse()
          Deprecated. use getServerResponse()
 Table getTable(java.lang.String tableSummaryNameOrId)
           
 TestContext getTestContext()
          Provide access to test testContext.
 ITestingEngine getTestingEngine()
          Protected version of deprecated getDialog().
 java.lang.String getTestingEngineKey()
          Gets the Testing Engine Key that is used to find the proper testing engine class (HtmlUnitDialog / SeleniumDialog) for the tests.
 void gotoFrame(java.lang.String frameNameOrId)
          Make the given frame active.
 void gotoPage(java.lang.String url)
          Go to the given page like if user has typed the URL manually in the browser.
 void gotoRootWindow()
          Make the root window active.
 void gotoWindow(int windowID)
          Make a given window active.
 void gotoWindow(java.lang.String windowName)
          Make a given window active.
 void gotoWindowByTitle(java.lang.String title)
          Make first window with the given title active.
protected  ITestingEngine initializeDialog()
          Initializes the IJWebUnitDialog when the testing engine is null.
 void reset()
          Reset the current form using the default reset button.
 void saveAs(java.io.File f)
          Save the last downloaded page (or file) to the disk.
 void selectOption(java.lang.String selectName, int index, java.lang.String label)
          Select an option with a given display label in Nth select element.
 void selectOption(java.lang.String selectName, java.lang.String label)
          Select an option with a given display label in a select element.
 void selectOptionByValue(java.lang.String selectName, int index, java.lang.String value)
          Select an option with a given value in a select element.
 void selectOptionByValue(java.lang.String selectName, java.lang.String value)
          Select an option with a given value in the Nth select element.
 void selectOptions(java.lang.String selectName, int index, java.lang.String[] labels)
          Select options with given display labels in the Nth select element.
 void selectOptions(java.lang.String selectName, java.lang.String[] labels)
          Select options with given display labels in a select element.
 void selectOptionsByValues(java.lang.String selectName, int index, java.lang.String[] values)
          Select options with given values in the Nth select element.
 void selectOptionsByValues(java.lang.String selectName, java.lang.String[] values)
          Select options with given values in a select element.
 void setBaseUrl(java.lang.String url)
          Set the base url for the test context.
 void setBaseUrl(java.net.URL url)
          Set the base url for the test context.
 void setDialog(ITestingEngine aIJWebUnitDialog)
          Set the testing engine.
 void setExpectedJavaScriptAlert(java.lang.String message)
          Tell that the given alert box is expected.
 void setExpectedJavaScriptAlert(java.lang.String[] messages)
          Tell that the given alert boxes are expected in the given order.
 void setExpectedJavaScriptConfirm(java.lang.String[] messages, boolean[] actions)
          Tell that the given confirm boxes are expected in the given order.
 void setExpectedJavaScriptConfirm(java.lang.String message, boolean action)
          Tell that the given confirm boxe is expected.
 void setExpectedJavaScriptPrompt(java.lang.String[] messages, java.lang.String[] inputs)
          Tell that the given prompt boxes are expected in the given order.
 void setExpectedJavaScriptPrompt(java.lang.String message, java.lang.String input)
          Tell that the given prompt boxe is expected.
 void setFormElement(java.lang.String formElementName, java.lang.String value)
          Deprecated. use setTextField(String, String) or other methods
 void setHiddenField(java.lang.String inputName, java.lang.String value)
          Set the value of an hidden input field.
 void setIgnoreFailingStatusCodes(boolean ignore)
          Should the tester ignore failing status codes (300+)? Otherwise, failing status codes will throw an exception.
 void setLabeledFormElementField(java.lang.String id, java.lang.String value)
           
 void setScriptingEnabled(boolean value)
          Enable or disable Javascript support
 void setTestContext(TestContext aTestContext)
          Allows setting an external test testContext class that might be extended from TestContext.
 void setTestingEngineKey(java.lang.String testingEngineKey)
          Set the Testing Engine that you want to use for the tests based on the Testing Engine Key.
 void setTextField(java.lang.String inputName, java.lang.String value)
          Set the value of a text or password input field.
 void setTimeout(int milli)
          Set the timeout for the request.
 void setWorkingForm(int index)
          Begin interaction with a specified form.
 void setWorkingForm(java.lang.String nameOrId)
          Begin interaction with a specified form.
 void setWorkingForm(java.lang.String nameOrId, int index)
          Begin interaction with a specified form.
 void submit()
          Submit form - default submit button will be used (unnamed submit button, or named button if there is only one on the form.
 void submit(java.lang.String buttonName)
          Submit form by pressing named button.
 void submit(java.lang.String buttonName, java.lang.String buttonValue)
          Submit the form by pressing the named button with the given value (label).
 void uncheckCheckbox(java.lang.String checkBoxName)
          Deselect a specified checkbox.
 void uncheckCheckbox(java.lang.String checkBoxName, java.lang.String value)
          Deselect a specified checkbox.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WebTester

public WebTester()
Method Detail

getDialog

public ITestingEngine getDialog()
Deprecated. You should not use plugin specific functionality. Please ask for a new core feature instead.

Provides access to the testing engine for subclasses - in case functionality not yet wrappered required by test. If the testing engine is not explicitly set the JWebUnit framework will default to using the orignal testing engine, which is, htmlunit.

Returns:
IJWebUnitDialog instance used to wrapper htmlunit conversation.

setBaseUrl

public void setBaseUrl(java.lang.String url)
Set the base url for the test context.

Parameters:
url - Base url value - A trailing "/" is appended if not provided.

setBaseUrl

public void setBaseUrl(java.net.URL url)
Set the base url for the test context.

Parameters:
url - Base url value - A trailing "/" is appended if not provided.

getTestingEngine

public ITestingEngine getTestingEngine()
Protected version of deprecated getDialog(). Not deprecated for internal use.

Returns:
IJWebUnitDialog instance.

initializeDialog

protected ITestingEngine initializeDialog()
Initializes the IJWebUnitDialog when the testing engine is null. This will construct a new instance of the testing engine based on the specified testing engine key.


closeBrowser

public void closeBrowser()
Close the current conversation.


closeWindow

public void closeWindow()
Close the current window.


setDialog

public void setDialog(ITestingEngine aIJWebUnitDialog)
Set the testing engine.

Parameters:
aIJWebUnitDialog - Testing engine.

getTestContext

public TestContext getTestContext()
Provide access to test testContext.

Returns:
TestContext

setTestContext

public void setTestContext(TestContext aTestContext)
Allows setting an external test testContext class that might be extended from TestContext. Example: setTestContext(new CompanyATestContext()); CompanyATestContext extends TestContext.

Parameters:
aTestContext -

beginAt

public void beginAt(java.lang.String aRelativeURL)
             throws TestingEngineResponseException
Begin conversation at a URL absolute or relative to base URL. Use getTestContext().setBaseUrl(String) to define base URL. Absolute URL should start with "http://", "https://" or "www.".

Parameters:
url - absolute or relative URL (relative to base URL).
Throws:
TestingEngineResponseException - If something bad happend (404)

getMessage

public java.lang.String getMessage(java.lang.String key)
Return the value of a web resource based on its key. This translates to a property file lookup with the locale based on the current TestContext.

Parameters:
key - name of the web resource.
Returns:
value of the web resource, encoded according to TestContext.

getMessage

public java.lang.String getMessage(java.lang.String key,
                                   java.lang.Object[] args)
Return the value of a web resource based on its key, using MessageFormat to perform parametric substitution with formatting.

Parameters:
key - name of the web resource.
args - array of arguments to be formatted into message
Returns:
value of the web resource after formatting
See Also:
MessageFormat

assertResponseCode

public void assertResponseCode(int status)
Assert that the page response has a particular code.

Parameters:
status - the expected status code

assertResponseCodeBetween

public void assertResponseCodeBetween(int lower,
                                      int higher)
Assert that the page response has a particular code between lower and higher (lower <= status <= higher).

Parameters:
lower - the lower bound for the expected status code
higher - the upper bound for the expected status code

setIgnoreFailingStatusCodes

public void setIgnoreFailingStatusCodes(boolean ignore)
Should the tester ignore failing status codes (300+)? Otherwise, failing status codes will throw an exception.

Parameters:
ignore -

assertHeaderPresent

public void assertHeaderPresent(java.lang.String name)
Assert a header is present.

Parameters:
name - The header to find

assertHeaderNotPresent

public void assertHeaderNotPresent(java.lang.String name)
Assert a header is NOT present.

Parameters:
name - The header to find

assertHeaderEquals

public void assertHeaderEquals(java.lang.String name,
                               java.lang.String value)
Assert a header is equal to a particular value.

Parameters:
name - Header to find
value - Value to compare against

assertHeaderMatches

public void assertHeaderMatches(java.lang.String name,
                                java.lang.String regexp)
Assert a header matches a particular pattern.

Parameters:
name - Header to find
regexp - Pattern to compare against

getHeader

public java.lang.String getHeader(java.lang.String name)
Get a particular header value.

Parameters:
name - Header to find
Returns:
The found header value, or null

getAllHeaders

public java.util.Map<java.lang.String,java.lang.String> getAllHeaders()
Get all response headers.

Returns:
A map of response headers

assertTitleEquals

public void assertTitleEquals(java.lang.String title)
Assert title of current html page in conversation matches an expected value.

Parameters:
title - expected title value

assertTitleNotSame

public void assertTitleNotSame(java.lang.String title)
Assert title of current html page in conversation is not equal to another value.

Parameters:
title - unexpected title value

assertTitleMatch

public void assertTitleMatch(java.lang.String regexp)
Assert title of current html page in conversation matches an expected regexp.

Parameters:
regexp - expected title regexp

assertTitleEqualsKey

public void assertTitleEqualsKey(java.lang.String titleKey)
Assert title of current html page matches the value of a specified web resource.

Parameters:
titleKey - web resource key for title

assertTitleEqualsKey

public void assertTitleEqualsKey(java.lang.String titleKey,
                                 java.lang.Object[] args)
Assert title of current page matches formatted message resource

Parameters:
titleKey -
args -

assertKeyPresent

public void assertKeyPresent(java.lang.String key)
Assert that a web resource's value is present.

Parameters:
key - web resource name

assertKeyPresent

public void assertKeyPresent(java.lang.String key,
                             java.lang.Object[] args)
Assert that a web resource's value (with formatting) is present

Parameters:
key -
args -

assertTextPresent

public void assertTextPresent(java.lang.String text)
Assert that supplied text is present.

Parameters:
text -

assertMatch

public void assertMatch(java.lang.String regexp)
Assert that supplied regexp is matched in the text of a page.

Parameters:
regexp -

assertMatch

public void assertMatch(java.lang.String regexp,
                        java.lang.String text)
Assert a given string matches a given regular expression.

Parameters:
regexp -
text -

assertNotMatch

public void assertNotMatch(java.lang.String regexp,
                           java.lang.String text)
Assert a given string does not match a given regular expression.

Parameters:
regexp -
text -

assertMatch

public void assertMatch(java.lang.String message,
                        java.lang.String regexp,
                        java.lang.String text)
Assert a given string matches a given regular expression.

Parameters:
regexp -
text -

assertNotMatch

public void assertNotMatch(java.lang.String message,
                           java.lang.String regexp,
                           java.lang.String text)
Assert a given string does not match a given regular expression.

Parameters:
regexp -
text -

assertKeyNotPresent

public void assertKeyNotPresent(java.lang.String key)
Assert that a web resource's value is not present.

Parameters:
key - web resource name

assertKeyNotPresent

public void assertKeyNotPresent(java.lang.String key,
                                java.lang.Object[] args)
Assert that a web resource's formatted value is not present.

Parameters:
key - web resource name

assertTextNotPresent

public void assertTextNotPresent(java.lang.String text)
Assert that supplied text is not present.

Parameters:
text -

assertNoMatch

public void assertNoMatch(java.lang.String regexp)
Assert that supplied regexp is not present.

Parameters:
regexp -

getTable

public Table getTable(java.lang.String tableSummaryNameOrId)
Parameters:
tableSummaryNameOrId -
Returns:
Object that represent a html table in a way independent from plugin.

assertTablePresent

public void assertTablePresent(java.lang.String tableSummaryNameOrId)
Assert that a table with a given summary or id value is present.

Parameters:
tableSummaryNameOrId - summary, name or id attribute value of table

assertTableNotPresent

public void assertTableNotPresent(java.lang.String tableSummaryNameOrId)
Assert that a table with a given summary or id value is not present.

Parameters:
tableSummaryNameOrId - summary, name or id attribute value of table

assertKeyInTable

public void assertKeyInTable(java.lang.String tableSummaryOrId,
                             java.lang.String key)
Assert that the value of a given web resource is present in a specific table.

Parameters:
tableSummaryOrId - summary or id attribute value of table
key - web resource name

assertKeyInTable

public void assertKeyInTable(java.lang.String tableSummaryOrId,
                             java.lang.String key,
                             java.lang.Object[] args)
Assert that the value of a given web resource is present in a specific table.

Parameters:
tableSummaryOrId - summary or id attribute value of table
key - web resource name

assertTextInTable

public void assertTextInTable(java.lang.String tableSummaryNameOrId,
                              java.lang.String text)
Assert that supplied text is present in a specific table.

Parameters:
tableSummaryNameOrId - summary, name or id attribute value of table
text -

assertMatchInTable

public void assertMatchInTable(java.lang.String tableSummaryNameOrId,
                               java.lang.String regexp)
Assert that supplied regexp is matched in a specific table.

Parameters:
tableSummaryNameOrId - summary, name or id attribute value of table
regexp -

assertKeysInTable

public void assertKeysInTable(java.lang.String tableSummaryOrId,
                              java.lang.String[] keys)
Assert that the values of a set of web resources are all present in a specific table.

Parameters:
tableSummaryOrId - summary, name or id attribute value of table
keys - Array of web resource names.

assertKeysInTable

public void assertKeysInTable(java.lang.String tableSummaryOrId,
                              java.lang.String[] keys,
                              java.lang.Object[][] args)
Assert that the values of a set of web resources are all present in a specific table.

Parameters:
tableSummaryOrId - summary or id attribute value of table
keys - Array of web resource names.

assertTextInTable

public void assertTextInTable(java.lang.String tableSummaryOrId,
                              java.lang.String[] text)
Assert that a set of text values are all present in a specific table.

Parameters:
tableSummaryOrId - summary, name or id attribute value of table
text - Array of expected text values.

assertMatchInTable

public void assertMatchInTable(java.lang.String tableSummaryOrId,
                               java.lang.String[] regexp)
Assert that a set of regexp values are all matched in a specific table.

Parameters:
tableSummaryOrId - summary, name or id attribute value of table
text - Array of expected regexps to match.

assertKeyNotInTable

public void assertKeyNotInTable(java.lang.String tableSummaryOrId,
                                java.lang.String key)
Assert that the value of a given web resource is not present in a specific table.

Parameters:
tableSummaryOrId - summary, name or id attribute value of table
key - web resource name

assertTextNotInTable

public void assertTextNotInTable(java.lang.String tableSummaryNameOrId,
                                 java.lang.String text)
Assert that supplied text is not present in a specific table.

Parameters:
tableSummaryNameOrId - summary, name or id attribute value of table
text -

assertTextNotInTable

public void assertTextNotInTable(java.lang.String tableSummaryNameOrId,
                                 java.lang.String[] text)
Assert that none of a set of text values are present in a specific table.

Parameters:
tableSummaryNameOrId - summary, name or id attribute value of table
text - Array of text values

assertNoMatchInTable

public void assertNoMatchInTable(java.lang.String tableSummaryNameOrId,
                                 java.lang.String regexp)
Assert that supplied regexp is not present in a specific table.

Parameters:
tableSummaryNameOrId - summary, name or id attribute value of table
text -

assertNoMatchInTable

public void assertNoMatchInTable(java.lang.String tableSummaryNameOrId,
                                 java.lang.String[] regexp)
Assert that none of a set of regexp values are present in a specific table.

Parameters:
tableSummaryNameOrId - summary, name or id attribute value of table
text - Array of text values

assertTableEquals

public void assertTableEquals(java.lang.String tableSummaryNameOrId,
                              Table expectedTable)
Assert that a specific table matches an ExpectedTable.

Parameters:
tableSummaryNameOrId - summary, name or id attribute value of table
expectedTable - represents expected values (colspan supported).

assertTableEquals

public void assertTableEquals(java.lang.String tableSummaryNameOrId,
                              java.lang.String[][] expectedCellValues)
Assert that a specific table matches a matrix of supplied text values.

Parameters:
tableSummaryNameOrId - summary, name or id attribute value of table
expectedCellValues - double dimensional array of expected values

assertTableRowsEqual

public void assertTableRowsEqual(java.lang.String tableSummaryNameOrId,
                                 int startRow,
                                 Table expectedTable)
Assert that a range of rows for a specific table matches a matrix of supplied text values.

Parameters:
tableSummaryNameOrId - summary, name or id attribute value of table
startRow - index of start row for comparison
expectedTable - represents expected values (colspan and rowspan supported).

assertTableRowsEqual

public void assertTableRowsEqual(java.lang.String tableSummaryNameOrId,
                                 int startRow,
                                 java.lang.String[][] expectedTable)
Assert that a range of rows for a specific table matches a matrix of supplied text values.

Parameters:
tableSummaryNameOrId - summary, name or id attribute value of table
startRow - index of start row for comparison
expectedTable - represents expected values (colspan and rowspan supported).

assertTableRowCountEquals

public void assertTableRowCountEquals(java.lang.String tableSummaryNameOrId,
                                      int expectedRowCount)
Assert that the number of rows for a specific table equals expected value.

Parameters:
tableSummaryNameOrId - summary, name or id attribute value of table
expectedRowCount - expected row count.

assertTableMatch

public void assertTableMatch(java.lang.String tableSummaryOrId,
                             Table expectedTable)
Assert that a specific table matches an ExpectedTable.

Parameters:
tableSummaryOrId - summary or id attribute value of table
expectedTable - represents expected regexps (colspan supported).

assertTableMatch

public void assertTableMatch(java.lang.String tableSummaryOrId,
                             java.lang.String[][] expectedCellValues)
Assert that a specific table matches a matrix of supplied regexps.

Parameters:
tableSummaryOrId - summary or id attribute value of table
expectedCellValues - double dimensional array of expected regexps

assertTableRowsMatch

public void assertTableRowsMatch(java.lang.String tableSummaryOrId,
                                 int startRow,
                                 Table expectedTable)
Assert that a range of rows for a specific table matches a matrix of supplied regexps.

Parameters:
tableSummaryOrId - summary or id attribute value of table
startRow - index of start row for comparison
expectedTable - represents expected regexps (colspan and rowspan supported).

assertTableRowsMatch

public void assertTableRowsMatch(java.lang.String tableSummaryOrId,
                                 int startRow,
                                 java.lang.String[][] expectedTable)
Assert that a range of rows for a specific table matches a matrix of supplied regexps.

Parameters:
tableSummaryOrId - summary or id attribute value of table
startRow - index of start row for comparison
expectedTable - represents expected regexps (colspan and rowspan not supported).

assertFormElementPresent

public void assertFormElementPresent(java.lang.String formElementName)
Assert that a form input element with a given name is present.

Parameters:
formElementName -

assertFormElementNotPresent

public void assertFormElementNotPresent(java.lang.String formElementName)
Assert that a form input element with a given name is not present.

Parameters:
formElementName -

assertCheckboxPresent

public void assertCheckboxPresent(java.lang.String checkboxName)
Assert that a form checkbox with a given name is present.

Parameters:
checkboxName - checkbox name.

assertCheckboxPresent

public void assertCheckboxPresent(java.lang.String checkboxName,
                                  java.lang.String checkboxValue)
Assert that a given checkbox is present.

Parameters:
checkboxName - checkbox name attribut.
checkboxValue - checkbox value attribut.

assertCheckboxNotPresent

public void assertCheckboxNotPresent(java.lang.String checkboxName)
Assert that a form checkbox with a given name is not present.

Parameters:
checkboxName - checkbox name.

assertCheckboxNotPresent

public void assertCheckboxNotPresent(java.lang.String checkboxName,
                                     java.lang.String checkboxValue)
Assert that a given checkbox is not present.

Parameters:
checkboxName - checkbox name.
checkboxValue - checkbox value attribut.

assertFormPresent

public void assertFormPresent()
Assert that there is a form present.


assertFormPresent

public void assertFormPresent(java.lang.String nameOrID)
Assert that there is a form with the specified name or id present.

Parameters:
nameOrID -

assertFormNotPresent

public void assertFormNotPresent()
Assert that there is not a form present.


assertFormNotPresent

public void assertFormNotPresent(java.lang.String nameOrID)
Assert that there is not a form with the specified name or id present.

Parameters:
nameOrID -

assertFormElementEquals

public void assertFormElementEquals(java.lang.String formElementName,
                                    java.lang.String expectedValue)
Deprecated. use an explicit testing method, e.g. assertTextFieldEquals(String, String)

Assert that a specific form element has an expected value. Can be used to check hidden input.

Parameters:
formElementName -
expectedValue -
See Also:
assertTextFieldEquals(String, String)

assertFormElementMatch

public void assertFormElementMatch(java.lang.String formElementName,
                                   java.lang.String regexp)
Assert that a specific form element matches an expected regexp.

Parameters:
formElementName -
regexp -

assertFormElementEmpty

public void assertFormElementEmpty(java.lang.String formElementName)
Deprecated. use an explicit testing method, e.g. setTextField(String, String) or setHiddenField(String, String)

Assert that a form element had no value / is empty.

Parameters:
formElementName -
See Also:
setTextField(String, String), setHiddenField(String, String)

assertTextFieldEquals

public void assertTextFieldEquals(java.lang.String formElementName,
                                  java.lang.String expectedValue)
Assert that an input text element with name formElementName has the expectedValue value.

Parameters:
formElementName - the value of the name attribute of the element
expectedValue - the expected value of the given input element

assertHiddenFieldPresent

public void assertHiddenFieldPresent(java.lang.String formElementName,
                                     java.lang.String expectedValue)
Assert that an input hidden element with name formElementName has the expectedValue value.

Parameters:
formElementName - the value of the name attribute of the element
expectedValue - the expected value of the given input element

assertCheckboxSelected

public void assertCheckboxSelected(java.lang.String checkBoxName)
Assert that a specific checkbox is selected.

Parameters:
checkBoxName -

assertCheckboxSelected

public void assertCheckboxSelected(java.lang.String checkBoxName,
                                   java.lang.String checkBoxValue)
Assert that a specific checkbox is selected.

Parameters:
checkBoxName -
checkBoxValue -

assertCheckboxNotSelected

public void assertCheckboxNotSelected(java.lang.String checkBoxName)
Assert that a specific checkbox is not selected.

Parameters:
checkBoxName -

assertCheckboxNotSelected

public void assertCheckboxNotSelected(java.lang.String checkBoxName,
                                      java.lang.String checkBoxValue)
Assert that a specific checkbox is not selected.

Parameters:
checkBoxName -
checkBoxValue -

assertRadioOptionPresent

public void assertRadioOptionPresent(java.lang.String name,
                                     java.lang.String radioOption)
Assert that a specific option is present in a radio group.

Parameters:
name - radio group name.
radioOption - option to test for.

assertRadioOptionNotPresent

public void assertRadioOptionNotPresent(java.lang.String name,
                                        java.lang.String radioOption)
Assert that a specific option is not present in a radio group.

Parameters:
name - radio group name.
radioOption - option to test for.

assertRadioOptionSelected

public void assertRadioOptionSelected(java.lang.String name,
                                      java.lang.String radioOption)
Assert that a specific option is selected in a radio group.

Parameters:
name - radio group name.
radioOption - option to test for selection.

assertRadioOptionNotSelected

public void assertRadioOptionNotSelected(java.lang.String name,
                                         java.lang.String radioOption)
Assert that a specific option is not selected in a radio group.

Parameters:
name - radio group name.
radioOption - option to test for selection.

assertSelectOptionsPresent

public void assertSelectOptionsPresent(java.lang.String selectName,
                                       java.lang.String[] optionLabels)
Assert that given options are present in a select box (by label).

Parameters:
selectName - name of the select element.
optionLabels - option labels.

assertSelectOptionPresent

public void assertSelectOptionPresent(java.lang.String selectName,
                                      java.lang.String optionLabel)
Assert that a specific option is present in a select box (by label).

Parameters:
selectName - name of the select element.
optionLabel - option label.

assertSelectOptionsPresent

public void assertSelectOptionsPresent(java.lang.String selectName,
                                       int index,
                                       java.lang.String[] optionLabels)
Assert that given options are present in the Nth select box (by label).

Parameters:
selectName - name of the select element.
index - the 0-based index of the select element when multiple select elements are expected.
optionLabels - option labels.

assertSelectOptionPresent

public void assertSelectOptionPresent(java.lang.String selectName,
                                      int index,
                                      java.lang.String optionLabel)
Assert that a specific option is present in the Nth select box (by label).

Parameters:
selectName - name of the select element.
index - the 0-based index of the select element when multiple select elements are expected.
optionLabel - option label.

assertSelectOptionValuesPresent

public void assertSelectOptionValuesPresent(java.lang.String selectName,
                                            java.lang.String[] optionValues)
Assert that given options are present in a select box (by value).

Parameters:
selectName - name of the select element.
optionValues - option labels.

assertSelectOptionValuePresent

public void assertSelectOptionValuePresent(java.lang.String selectName,
                                           java.lang.String optionValue)
Assert that a specific option is present in a select box (by value).

Parameters:
selectName - name of the select element.
optionValue - option value.

assertSelectOptionValuesPresent

public void assertSelectOptionValuesPresent(java.lang.String selectName,
                                            int index,
                                            java.lang.String[] optionValues)
Assert that given options are present in the Nth select box (by value).

Parameters:
selectName - name of the select element.
index - the 0-based index of the select element when multiple select elements are expected.
optionValues - option labels.

assertSelectOptionValuePresent

public void assertSelectOptionValuePresent(java.lang.String selectName,
                                           int index,
                                           java.lang.String optionValue)
Assert that a specific option is present in the Nth select box (by value).

Parameters:
selectName - name of the select element.
index - the 0-based index of the select element when multiple select elements are expected.
optionValue - option value.

assertSelectOptionValueNotPresent

public void assertSelectOptionValueNotPresent(java.lang.String selectName,
                                              java.lang.String optionValue)
Assert that a specific option value is not present in a select box.

Parameters:
selectName - name of the select element.
optionValue - option value.

assertSelectOptionNotPresent

public void assertSelectOptionNotPresent(java.lang.String selectName,
                                         java.lang.String optionLabel)
Assert that a specific option is not present in a select box.

Parameters:
selectName - name of the select element.
expectedOption - option label.

assertSelectOptionValueNotPresent

public void assertSelectOptionValueNotPresent(java.lang.String selectName,
                                              int index,
                                              java.lang.String optionValue)
Assert that a specific option value is not present in a select box.

Parameters:
selectName - name of the select element.
optionValue - option value.

assertSelectOptionNotPresent

public void assertSelectOptionNotPresent(java.lang.String selectName,
                                         int index,
                                         java.lang.String optionLabel)
Assert that a specific option is not present in a select box.

Parameters:
selectName - name of the select element.
expectedOption - option label.

assertSelectOptionsEqual

public void assertSelectOptionsEqual(java.lang.String selectName,
                                     java.lang.String[] expectedOptions)
Assert that the display values of a select element's options match a given array of strings.

Parameters:
selectName - name of the select element.
expectedOptions - expected labels for the select box.

assertSelectOptionsEqual

public void assertSelectOptionsEqual(java.lang.String selectName,
                                     int index,
                                     java.lang.String[] expectedOptions)
Assert that the display values of the Nth select element's options match a given array of strings.

Parameters:
selectName - name of the select element.
index - the 0-based index of the select element when multiple select elements are expected.
expectedOptions - expected labels for the select box.

assertSelectOptionsNotEqual

public void assertSelectOptionsNotEqual(java.lang.String selectName,
                                        java.lang.String[] expectedOptions)
Assert that the display values of a select element's options do not match a given array of strings.

Parameters:
selectName - name of the select element.
expectedOptions - expected display values for the select box.

assertSelectOptionsNotEqual

public void assertSelectOptionsNotEqual(java.lang.String selectName,
                                        int index,
                                        java.lang.String[] expectedOptions)
Assert that the display values of the Nth select element's options do not match a given array of strings.

Parameters:
selectName - name of the select element.
index - the 0-based index of the select element when multiple select elements are expected.
expectedOptions - expected display values for the select box.

assertSelectOptionValuesEqual

public void assertSelectOptionValuesEqual(java.lang.String selectName,
                                          int index,
                                          java.lang.String[] expectedValues)
Assert that the values of the Nth select element's options match a given array of strings.

Parameters:
selectName - name of the select element.
index - the 0-based index of the select element when multiple select elements are expected.
expectedValues - expected values for the select box.

assertSelectOptionValuesEqual

public void assertSelectOptionValuesEqual(java.lang.String selectName,
                                          java.lang.String[] expectedValues)
Assert that the values of a select element's options match a given array of strings.

Parameters:
selectName - name of the select element.
expectedValues - expected values for the select box.

assertSelectOptionValuesNotEqual

public void assertSelectOptionValuesNotEqual(java.lang.String selectName,
                                             java.lang.String[] optionValues)
Assert that the values of a select element's options do not match a given array of strings.

Parameters:
selectName - name of the select element.
optionValues - expected values for the select box.

assertSelectOptionValuesNotEqual

public void assertSelectOptionValuesNotEqual(java.lang.String selectName,
                                             int index,
                                             java.lang.String[] optionValues)
Assert that the values of the Nth select element's options do not match a given array of strings.

Parameters:
selectName - name of the select element.
index - the 0-based index of the select element when multiple select elements are expected.
optionValues - expected values for the select box.

assertSelectedOptionsEqual

public void assertSelectedOptionsEqual(java.lang.String selectName,
                                       java.lang.String[] labels)
Assert that the currently selected display label(s) of a select box matches given label(s).

Parameters:
selectName - name of the select element.
labels - expected display label(s) of the selected option.

assertSelectedOptionsEqual

public void assertSelectedOptionsEqual(java.lang.String selectName,
                                       int index,
                                       java.lang.String[] labels)
Assert that the currently selected display label(s) of a select box matches given label(s).

Parameters:
selectName - name of the select element.
index - the 0-based index used when more than one select element with the same name is expected.
labels - expected display label(s) of the selected option.

assertSelectedOptionEquals

public void assertSelectedOptionEquals(java.lang.String selectName,
                                       java.lang.String optionLabel)
Assert that the label of the current selected option matches the provided value.

Parameters:
selectName - name of the select element
optionLabel - expected value of the option label

assertSelectedOptionEquals

public void assertSelectedOptionEquals(java.lang.String selectName,
                                       int index,
                                       java.lang.String option)
Assert that the label of the current selected option matches the provided value in the Nth select element with the specified name.

Parameters:
selectName - name of the select element
index - the 0-based index used when more than one select element with the same name is expected.
optionLabel - expected value of the option label

assertSelectedOptionValuesEqual

public void assertSelectedOptionValuesEqual(java.lang.String selectName,
                                            java.lang.String[] values)
Assert that the currently selected value(s) of a select box matches given value(s).

Parameters:
selectName - name of the select element.
values - expected value(s) of the selected option.

assertSelectedOptionValuesEqual

public void assertSelectedOptionValuesEqual(java.lang.String selectName,
                                            int index,
                                            java.lang.String[] values)
Assert that the currently selected value(s) of the Nth select box with the specified name matches given value(s).

Parameters:
selectName - name of the select element.
index - the 0-based index used when more than one select element with the same name is expected.
values - expected value(s) of the selected option.

assertSelectedOptionValueEquals

public void assertSelectedOptionValueEquals(java.lang.String selectName,
                                            java.lang.String value)
Assert that the currently selected value of a select box matches given value.

Parameters:
selectName - name of the select element.
value - expected value of the selected option.

assertSelectedOptionValueEquals

public void assertSelectedOptionValueEquals(java.lang.String selectName,
                                            int index,
                                            java.lang.String value)
Assert that the currently selected value of a select box matches given value.

Parameters:
selectName - name of the select element.
index - the 0-based index used when more than one select element with the same name is expected.
value - expected value of the selected option.

assertSelectedOptionsMatch

public void assertSelectedOptionsMatch(java.lang.String selectName,
                                       java.lang.String[] regexps)
Assert that the currently selected display value(s) of a select box matches a given value(s).

Parameters:
selectName - name of the select element.
regexps - expected display value of the selected option.

assertSelectedOptionsMatch

public void assertSelectedOptionsMatch(java.lang.String selectName,
                                       int index,
                                       java.lang.String[] regexps)
Assert that the currently selected display value(s) of a select box matches a given value(s).

Parameters:
selectName - name of the select element.
index - the 0-based index used when more than one select element with the same name is expected.
regexps - expected display value of the selected option.

assertSelectedOptionMatches

public void assertSelectedOptionMatches(java.lang.String selectName,
                                        java.lang.String regexp)
Assert that the label of the current selected option matches the provided regular expression value.

Parameters:
selectName - name of the select element
regexp - the regular expression to match

assertSelectedOptionMatches

public void assertSelectedOptionMatches(java.lang.String selectName,
                                        int index,
                                        java.lang.String regexp)
Assert that the label of the current selected option matches the provided regular expression in the Nth select element with the specified name.

Parameters:
selectName - name of the select element
index - the 0-based index used when more than one select element with the same name is expected.
regexp - the regular expression to match

assertSubmitButtonPresent

public void assertSubmitButtonPresent()
Assert that a submit button is present.
A submit button can be the following HTML elements:


assertSubmitButtonPresent

public void assertSubmitButtonPresent(java.lang.String buttonName)
Assert that a submit button with a given name is present.
A submit button can be the following HTML elements:

Parameters:
buttonName -

assertSubmitButtonNotPresent

public void assertSubmitButtonNotPresent()
Assert that no submit button is present in the current form.
A submit button can be the following HTML elements:

Parameters:
buttonName -

assertSubmitButtonNotPresent

public void assertSubmitButtonNotPresent(java.lang.String buttonName)
Assert that a submit button with a given name is not present.
A submit button can be the following HTML elements:

Parameters:
buttonName -

assertSubmitButtonPresent

public void assertSubmitButtonPresent(java.lang.String buttonName,
                                      java.lang.String buttonValue)
Assert that a submit button with a given name and value is present.
A submit button can be the following HTML elements:

Parameters:
buttonName -
buttonValue -

assertResetButtonPresent

public void assertResetButtonPresent()
Assert that a reset button is present.
A reset button can be the following HTML elements:


assertResetButtonPresent

public void assertResetButtonPresent(java.lang.String buttonName)
Assert that a reset button with a given name is present.
A reset button can be the following HTML elements:

Parameters:
buttonName -

assertResetButtonNotPresent

public void assertResetButtonNotPresent()
Assert that no reset button is present in the current form.
A reset button can be the following HTML elements:

Parameters:
buttonName -

assertResetButtonNotPresent

public void assertResetButtonNotPresent(java.lang.String buttonName)
Assert that a reset button with a given name is not present.
A reset button can be the following HTML elements:

Parameters:
buttonName -

assertButtonPresent

public void assertButtonPresent(java.lang.String buttonId)
Assert that a button with a given id is present in the current window.
A button can be the following HTML elements:

Parameters:
buttonId -

assertButtonPresentWithText

public void assertButtonPresentWithText(java.lang.String text)
Assert that a button with a given text is present in the current window.

Parameters:
text - Text representation of button content.

assertButtonNotPresentWithText

public void assertButtonNotPresentWithText(java.lang.String text)
Assert that a button with a given text is not present in the current window.

Parameters:
text - Text representation of button content.

assertButtonNotPresent

public void assertButtonNotPresent(java.lang.String buttonId)
Assert that a button with a given id is not present in the current window.

Parameters:
buttonId -

assertLinkPresent

public void assertLinkPresent(java.lang.String linkId)
Assert that a link with a given id is present in the response.

Parameters:
linkId -

assertLinkNotPresent

public void assertLinkNotPresent(java.lang.String linkId)
Assert that no link with the given id is present in the response.

Parameters:
linkId -

assertLinkPresentWithText

public void assertLinkPresentWithText(java.lang.String linkText)
Assert that a link containing the supplied text is present.

Parameters:
linkText -

assertLinkNotPresentWithText

public void assertLinkNotPresentWithText(java.lang.String linkText)
Assert that no link containing the supplied text is present.

Parameters:
linkText -

assertLinkPresentWithText

public void assertLinkPresentWithText(java.lang.String linkText,
                                      int index)
Assert that a link containing the supplied text is present.

Parameters:
linkText -
index - The 0-based index, when more than one link with the same text is expected.

assertLinkNotPresentWithText

public void assertLinkNotPresentWithText(java.lang.String linkText,
                                         int index)
Assert that no link containing the supplied text is present.

Parameters:
linkText -
index - The 0-based index, when more than one link with the same text is expected.

assertLinkPresentWithExactText

public void assertLinkPresentWithExactText(java.lang.String linkText)
Assert that a link containing the Exact text is present.

Parameters:
linkText -

assertLinkNotPresentWithExactText

public void assertLinkNotPresentWithExactText(java.lang.String linkText)
Assert that no link containing the Exact text is present.

Parameters:
linkText -

assertLinkPresentWithExactText

public void assertLinkPresentWithExactText(java.lang.String linkText,
                                           int index)
Assert that a link containing the Exact text is present.

Parameters:
linkText -
index - The 0-based index, when more than one link with the same text is expected.

assertLinkNotPresentWithExactText

public void assertLinkNotPresentWithExactText(java.lang.String linkText,
                                              int index)
Assert that no link containing the Exact text is present.

Parameters:
linkText -
index - The 0-based index, when more than one link with the same text is expected.

assertLinkPresentWithImage

public void assertLinkPresentWithImage(java.lang.String imageFileName)
Assert that a link containing a specified image is present.

Parameters:
imageFileName - A suffix of the image's filename; for example, to match "images/my_icon.png", you could just pass in "my_icon.png".

assertLinkNotPresentWithImage

public void assertLinkNotPresentWithImage(java.lang.String imageFileName)
Assert that a link containing a specified image is not present.

Parameters:
imageFileName - A suffix of the image's filename; for example, to match "images/my_icon.png", you could just pass in "my_icon.png".

assertElementPresent

public void assertElementPresent(java.lang.String anID)
Assert that an element with a given id is present.

Parameters:
anID - element id to test for.

assertElementNotPresent

public void assertElementNotPresent(java.lang.String anID)
Assert that an element with a given id is not present.

Parameters:
anID - element id to test for.

assertElementPresentByXPath

public void assertElementPresentByXPath(java.lang.String xpath)
Assert that an element with a given xpath is present.

Parameters:
xpath - element xpath to test for.

assertElementNotPresentByXPath

public void assertElementNotPresentByXPath(java.lang.String xpath)
Assert that an element with a given xpath is not present.

Parameters:
xpath - element xpath to test for.

getComments

public java.util.List<java.lang.String> getComments()
Get all the comments in a document, as a list of strings.


assertCommentPresent

public void assertCommentPresent(java.lang.String comment)
Assert that a comment is present.

Parameters:
comment -

assertCommentNotPresent

public void assertCommentNotPresent(java.lang.String comment)
Assert that a comment is not present.

Parameters:
comment -

assertTextInElement

public void assertTextInElement(java.lang.String elementID,
                                java.lang.String text)
Assert that a given element contains specific text.

Parameters:
elementID - id of element to be inspected.
text - to check for.

assertTextNotInElement

public void assertTextNotInElement(java.lang.String elementID,
                                   java.lang.String text)

assertMatchInElement

public void assertMatchInElement(java.lang.String elementID,
                                 java.lang.String regexp)
Assert that a given element matches a specific regexp.

Parameters:
elementID - id of element to be inspected.
regexp - to match.

assertNoMatchInElement

public void assertNoMatchInElement(java.lang.String elementID,
                                   java.lang.String regexp)
Assert that a given element does not match a specific regexp.

Parameters:
elementID - id of element to be inspected.
regexp - to match.

assertWindowPresent

public void assertWindowPresent(java.lang.String windowName)
Assert that a window with the given name is open.

Parameters:
windowName -

assertWindowPresent

public void assertWindowPresent(int windowID)
Assert that a window with the given ID is open.

Parameters:
windowID - Javascript window ID.

assertWindowPresentWithTitle

public void assertWindowPresentWithTitle(java.lang.String title)
Assert that at least one window with the given title is open.

Parameters:
title -

assertWindowCountEquals

public void assertWindowCountEquals(int windowCount)
Assert that the number of opened windows equals given value.

Parameters:
windowCount - Window count

assertFramePresent

public void assertFramePresent(java.lang.String frameNameOrId)
Assert that a frame with the given name or ID is present.

Parameters:
frameNameOrId - Name or ID of the frame. ID is checked first.

assertCookiePresent

public void assertCookiePresent(java.lang.String cookieName)
Checks to see if a cookie is present in the response.

Parameters:
cookieName - The cookie name

assertCookieValueEquals

public void assertCookieValueEquals(java.lang.String cookieName,
                                    java.lang.String expectedValue)
Check to see if a cookie has the given value.

Parameters:
cookieName - The cookie name
expectedValue - The cookie value

assertCookieValueMatch

public void assertCookieValueMatch(java.lang.String cookieName,
                                   java.lang.String regexp)
Check to see if a cookie value match the given regexp.

Parameters:
cookieName - The cookie name
regexp - The regexp

getFormElementValue

public java.lang.String getFormElementValue(java.lang.String formElementName)
Deprecated. Use getElementAttributeByXPath(String, String)


setWorkingForm

public void setWorkingForm(int index)
Begin interaction with a specified form. If form interaction methods are called without explicitly calling this method first, JWebUnit will attempt to determine itself which form is being manipulated. It is not necessary to call this method if their is only one form on the current page.

Parameters:
index - 0-based index of the form to work with.

setWorkingForm

public void setWorkingForm(java.lang.String nameOrId)
Begin interaction with a specified form. If form interaction methods are called without explicitly calling this method first, JWebUnit will attempt to determine itself which form is being manipulated. It is not necessary to call this method if their is only one form on the current page.

Parameters:
nameOrId - name or id of the form to work with.

setWorkingForm

public void setWorkingForm(java.lang.String nameOrId,
                           int index)
Begin interaction with a specified form. If form interaction methods are called without explicitly calling this method first, JWebUnit will attempt to determine itself which form is being manipulated. It is not necessary to call this method if their is only one form on the current page.

Parameters:
nameOrId - name or id of the form to work with.
index - The 0-based index, when more than one form with the same name is expected.

setTextField

public void setTextField(java.lang.String inputName,
                         java.lang.String value)
Set the value of a text or password input field.

Parameters:
inputName - name of form element.
value - value to set.

setHiddenField

public void setHiddenField(java.lang.String inputName,
                           java.lang.String value)
Set the value of an hidden input field.

Parameters:
inputName - name of form element.
value - value to set.

checkCheckbox

public void checkCheckbox(java.lang.String checkBoxName)
Select a specified checkbox. If the checkbox is already checked then the checkbox will stay checked.

Parameters:
checkBoxName - name of checkbox to be selected.

checkCheckbox

public void checkCheckbox(java.lang.String checkBoxName,
                          java.lang.String value)
Select a specified checkbox. If the checkbox is already checked then the checkbox will stay checked.

Parameters:
checkBoxName - name of checkbox to be selected.
value - value of checkbox to be selected.

uncheckCheckbox

public void uncheckCheckbox(java.lang.String checkBoxName)
Deselect a specified checkbox. If the checkbox is already unchecked then the checkbox will stay unchecked.

Parameters:
checkBoxName - name of checkbox to be deselected.

uncheckCheckbox

public void uncheckCheckbox(java.lang.String checkBoxName,
                            java.lang.String value)
Deselect a specified checkbox. If the checkbox is already unchecked then the checkbox will stay unchecked.

Parameters:
checkBoxName - name of checkbox to be deselected.
value - value of checkbox to be deselected.

selectOptions

public void selectOptions(java.lang.String selectName,
                          java.lang.String[] labels)
Select options with given display labels in a select element.

Parameters:
selectName - name of select element.
labels - labels of options to be selected.

selectOption

public void selectOption(java.lang.String selectName,
                         java.lang.String label)
Select an option with a given display label in a select element.

Parameters:
selectName - name of select element.
label - label of option to be selected.

selectOption

public void selectOption(java.lang.String selectName,
                         int index,
                         java.lang.String label)
Select an option with a given display label in Nth select element.

Parameters:
selectName - name of select element.
index - the 0-based index of the select element when multiple select elements are expected.
label - label of option to be selected.

selectOptions

public void selectOptions(java.lang.String selectName,
                          int index,
                          java.lang.String[] labels)
Select options with given display labels in the Nth select element.

Parameters:
selectName - name of select element.
index - the 0-based index of the select element when multiple select elements are expected.
labels - labels of options to be selected.

selectOptionsByValues

public void selectOptionsByValues(java.lang.String selectName,
                                  java.lang.String[] values)
Select options with given values in a select element.

Parameters:
selectName - name of select element.
values - values of options to be selected.

selectOptionByValue

public void selectOptionByValue(java.lang.String selectName,
                                java.lang.String value)
Select an option with a given value in the Nth select element.

Parameters:
selectName - name of select element.
index - the 0-based index of the select element when multiple select elements are expected.
values - values of options to be selected.

selectOptionsByValues

public void selectOptionsByValues(java.lang.String selectName,
                                  int index,
                                  java.lang.String[] values)
Select options with given values in the Nth select element.

Parameters:
selectName - name of select element.
index - the 0-based index of the select element when multiple select elements are expected.
values - values of options to be selected.

selectOptionByValue

public void selectOptionByValue(java.lang.String selectName,
                                int index,
                                java.lang.String value)
Select an option with a given value in a select element.

Parameters:
selectName - name of select element.
values - values of options to be selected.

submit

public void submit()
Submit form - default submit button will be used (unnamed submit button, or named button if there is only one on the form.


submit

public void submit(java.lang.String buttonName)
Submit form by pressing named button.

Parameters:
buttonName - Submit button name attribut value.

submit

public void submit(java.lang.String buttonName,
                   java.lang.String buttonValue)
Submit the form by pressing the named button with the given value (label). Useful if you have more than one submit button with same name.

Parameters:
buttonName - Submit button name attribut value.
buttonValue - Submit button value attribut value.

reset

public void reset()
Reset the current form using the default reset button. See #getFormfor an explanation of how the current form is established.


clickLinkWithText

public void clickLinkWithText(java.lang.String linkText)
Navigate by selection of a link containing given text.

Parameters:
linkText - Text in the link.

clickLinkWithText

public void clickLinkWithText(java.lang.String linkText,
                              int index)
Navigate by selecting Nth link containing given text.

Parameters:
linkText - Text in the link.
index - The 0-based index, when more than one link with the same text is expected.

clickLinkWithExactText

public void clickLinkWithExactText(java.lang.String linkText)
Navigate by selection of a link with the exact given text.

Parameters:
linkText - Text of the link.

clickLinkWithExactText

public void clickLinkWithExactText(java.lang.String linkText,
                                   int index)
Navigate by selecting Nth link with the exact given text.

Parameters:
linkText - Text of the link.
index - The 0-based index, when more than one link with the same text is expected.

clickButton

public void clickButton(java.lang.String buttonId)
Click the button with the given id.

Parameters:
buttonId - Button ID attribut value.

clickButtonWithText

public void clickButtonWithText(java.lang.String buttonValueText)
Clicks a button with text of the value attribute.

Parameters:
buttonValueText - The text of the button (contents of the value attribute).

clickLinkWithImage

public void clickLinkWithImage(java.lang.String imageFileName)
Navigate by selection of a link with a given image.

Parameters:
imageFileName - A suffix of the image's filename; for example, to match "images/my_icon.png", you could just pass in "my_icon.png".

clickLink

public void clickLink(java.lang.String linkId)
Navigate by selection of a link with given id.

Parameters:
linkId - id of link

clickRadioOption

public void clickRadioOption(java.lang.String radioGroup,
                             java.lang.String radioOption)
Clicks a radio option. Asserts that the radio option exists first. *

Parameters:
radioGroup - name of the radio group.
radioOption - value of the option to check for.

clickElementByXPath

public void clickElementByXPath(java.lang.String xpath)
Click element with given xpath.

Parameters:
xpath - xpath of the element.

getElementAttributeByXPath

public java.lang.String getElementAttributeByXPath(java.lang.String xpath,
                                                   java.lang.String attribute)
Get the attribute value of the given element. For example, if you have an element <img src="test.gif" alt="picture"> getElementAttributeByXPath("//img[@src='test.gif']", "alt") returns "picture".

Parameters:
xpath - XPath of the element
attribute - Name of the attribute
Returns:
The value of the attribute

getElementAttributByXPath

public java.lang.String getElementAttributByXPath(java.lang.String xpath,
                                                  java.lang.String attribute)
Deprecated. Use getElementAttributeByXPath(String, String)


getElementTextByXPath

public java.lang.String getElementTextByXPath(java.lang.String xpath)
Get text of the given element.

Parameters:
xpath - xpath of the element.

getElementByXPath

public IElement getElementByXPath(java.lang.String xpath)
Get an element for a particular xpath.

Parameters:
xpath - XPath to search
Returns:
the requested element
Throws:
junit.framework.AssertionFailedError - if the element xpath is not found

getElementById

public IElement getElementById(java.lang.String id)
Get an element for a particular ID.

Parameters:
id - element ID to find
Returns:
the requested element
Throws:
junit.framework.AssertionFailedError - if the element is not found

getElementsByXPath

public java.util.List<IElement> getElementsByXPath(java.lang.String xpath)
Get elements for a particular xpath.

Parameters:
xpath - XPath to search
Returns:
the requested elements found

assertLabelPresent

public void assertLabelPresent(java.lang.String id)
Assert a label for a given ID exists.


assertLabelMatches

public void assertLabelMatches(java.lang.String regexp)
Assert a label exists.


getFieldsForLabel

public java.util.List<IElement> getFieldsForLabel(IElement label)
Get all the fields of type input, textarea or select that are referenced or contained in a particular label.

Parameters:
label - The label to consider
Returns:
A list of all fields contained or referenced in this label

getLabeledFieldValue

public java.lang.String getLabeledFieldValue(java.lang.String identifier,
                                             IElement label)
Get the current value of a given labelled field.

Parameters:
identifier - the HTML ID for the given labelled field
label - the label found for the given HTML ID
Returns:
the value found in a field for the given label/ID, or null if none was found

assertLabeledFieldEquals

public void assertLabeledFieldEquals(java.lang.String id,
                                     java.lang.String fieldText)
Assert that a labeled field exists (for the given ID) and the field that it labels equals the given text

Parameters:
id - the HTML ID for the given labelled field
fieldText - the text that the field's value should equal
See Also:
#getLabeledFieldValue(String, IElement, String), getLabel(String)

setLabeledFormElementField

public void setLabeledFormElementField(java.lang.String id,
                                       java.lang.String value)

gotoWindow

public void gotoWindow(java.lang.String windowName)
Make a given window active.

Parameters:
windowName - Name of the window.

gotoWindow

public void gotoWindow(int windowID)
Make a given window active.

Parameters:
windowID - Javascript ID of the window

gotoRootWindow

public void gotoRootWindow()
Make the root window active.


gotoWindowByTitle

public void gotoWindowByTitle(java.lang.String title)
Make first window with the given title active.

Parameters:
title - Title of the window.

gotoFrame

public void gotoFrame(java.lang.String frameNameOrId)
Make the given frame active.

Parameters:
frameNameOrId - Name or ID of the frame. ID is checked first.

gotoPage

public void gotoPage(java.lang.String url)
              throws TestingEngineResponseException
Go to the given page like if user has typed the URL manually in the browser. Use getTestContext().setBaseUrl(String) to define base URL. Absolute URL should start with "http://", "https://" or "www.".

Parameters:
url - absolute or relative URL (relative to base URL).
Throws:
TestingEngineResponseException - If something bad happend (404)

dumpCookies

public void dumpCookies()
Print all the cookies to stdout.


getPageSource

public java.lang.String getPageSource()
Get the source of the HTML page (like in a real browser), or HTTP body for a non HTML content.

Returns:
The HTML content.

getServerResponse

public java.lang.String getServerResponse()
Get the last data sent by the server.

Returns:
HTTP server response.

getServeurResponse

public java.lang.String getServeurResponse()
Deprecated. use getServerResponse()

Returns:

saveAs

public void saveAs(java.io.File f)
Save the last downloaded page (or file) to the disk.

Parameters:
f - The file name.

assertDownloadedFileEquals

public void assertDownloadedFileEquals(java.net.URL expected)
Download the current page (or file) and compare it with the given file.

Parameters:
expected - Expected file URL.

dumpHtml

public void dumpHtml()
Deprecated. Use getPageSource()

Dump html of current response to System.out - for debugging purposes.

Parameters:
stream -

dumpHtml

public void dumpHtml(java.io.PrintStream stream)
Deprecated. Use getPageSource()

Dump html of current response to a specified stream - for debugging purposes.

Parameters:
stream -

dumpTable

public void dumpTable(java.lang.String tableNameOrId)
Dump the table as the 2D array that is used for assertions - for debugging purposes.

Parameters:
tableNameOrId -
stream -

dumpTable

public void dumpTable(java.lang.String tableNameOrId,
                      java.io.PrintStream stream)
Dump the table as the 2D array that is used for assertions - for debugging purposes.

Parameters:
tableNameOrId -
table -
stream -

setScriptingEnabled

public void setScriptingEnabled(boolean value)
Enable or disable Javascript support


setTestingEngineKey

public void setTestingEngineKey(java.lang.String testingEngineKey)
Set the Testing Engine that you want to use for the tests based on the Testing Engine Key.

Parameters:
testingEngineKey - The testingEngineKey to set.
See Also:
TestingEngineRegistry

getTestingEngineKey

public java.lang.String getTestingEngineKey()
Gets the Testing Engine Key that is used to find the proper testing engine class (HtmlUnitDialog / SeleniumDialog) for the tests.

Returns:
Returns the testingEngineKey.

setFormElement

public void setFormElement(java.lang.String formElementName,
                           java.lang.String value)
Deprecated. use setTextField(String, String) or other methods

Set the value of a form input element.

Parameters:
formElementName - name of form element.
value -
See Also:
setTextField(String, String)

setExpectedJavaScriptAlert

public void setExpectedJavaScriptAlert(java.lang.String message)
Tell that the given alert box is expected.

Parameters:
message - Message in the alert.

setExpectedJavaScriptAlert

public void setExpectedJavaScriptAlert(java.lang.String[] messages)
Tell that the given alert boxes are expected in the given order.

Parameters:
messages - Messages in the alerts.

setExpectedJavaScriptConfirm

public void setExpectedJavaScriptConfirm(java.lang.String message,
                                         boolean action)
Tell that the given confirm boxe is expected.

Parameters:
message - Message in the confirm.
action - Whether we should click on "OK" (true) or "Cancel" (false)

setExpectedJavaScriptConfirm

public void setExpectedJavaScriptConfirm(java.lang.String[] messages,
                                         boolean[] actions)
Tell that the given confirm boxes are expected in the given order.

Parameters:
messages - Messages in the confirms.
actions - Whether we should click on "OK" (true) or "Cancel" (false)

setExpectedJavaScriptPrompt

public void setExpectedJavaScriptPrompt(java.lang.String message,
                                        java.lang.String input)
Tell that the given prompt boxe is expected.

Parameters:
message - Message in the prompt.
input - What we should put in the prompt (null if user press Cancel)

setExpectedJavaScriptPrompt

public void setExpectedJavaScriptPrompt(java.lang.String[] messages,
                                        java.lang.String[] inputs)
Tell that the given prompt boxes are expected in the given order.

Parameters:
messages - Messages in the prompts.
inputs - What we should put in the prompt (null if user press Cancel)

assertImagePresent

public void assertImagePresent(java.lang.String imageSrc,
                               java.lang.String imageAlt)
Assert there is at least one image in the page with given src and (optional) alt attributes.

Parameters:
imageSrc - Value of image src attribute.
imageAlt - Value of image alt attribute. Ignored when null.

assertImagePresentPartial

public void assertImagePresentPartial(java.lang.String partialImageSrc,
                                      java.lang.String partialImageAlt)
Assert there is at least one image in the page with given partial src and (optional) partial alt attributes.

Parameters:
partialImageSrc -
partialImageAlt -

assertImageValid

public void assertImageValid(java.lang.String imageSrc,
                             java.lang.String imageAlt)
See Also:
assertImageValidAndStore(String, String, java.io.File)

assertImageValidAndStore

public void assertImageValidAndStore(java.lang.String imageSrc,
                                     java.lang.String imageAlt,
                                     java.io.File out)
Asserts that the image with the given src and alt attribute values exist in the page and is an actual reachable image, then saves it as png with the given file name.

Parameters:
imageSrc - as it appears in the html page, i.e. relative to the current page.

getImage

public java.awt.Image getImage(java.lang.String imageSrc,
                               java.lang.String imageAlt)
See Also:
assertImageValidAndStore(String, String, java.io.File)

setTimeout

public void setTimeout(int milli)
Set the timeout for the request. A timeout of 0 means an infinite timeout.

Parameters:
milli - the milliseconds in which to timeout, or 0 for infinite wait (the default).

areFilesEqual

protected boolean areFilesEqual(java.net.URL f1,
                                java.net.URL f2)
                         throws java.io.IOException
Throws:
java.io.IOException


Copyright © 2002-2011 SourceForge. All Rights Reserved.