Modifier and Type | Method and Description |
---|---|
static void |
assertButtonNotPresent(String buttonId)
Assert that a button with a given id is not present in the current window.
|
static void |
assertButtonNotPresentWithText(String text)
Assert that a button with a given text is not present in the current window.
|
static void |
assertButtonPresent(String buttonId)
Assert that a button with a given id is present in the current window.
|
static void |
assertButtonPresentWithText(String text)
Assert that a button with a given text is present in the current window.
|
static void |
assertCheckboxNotPresent(String checkboxName)
Assert that a form checkbox with a given name is not present.
|
static void |
assertCheckboxNotPresent(String checkboxName,
String checkboxValue)
Assert that a given checkbox is not present.
|
static void |
assertCheckboxNotSelected(String checkBoxName)
Assert that a specific checkbox is not selected.
|
static void |
assertCheckboxNotSelected(String checkBoxName,
String checkBoxValue)
Assert that a specific checkbox is not selected.
|
static void |
assertCheckboxPresent(String checkboxName)
Assert that a form checkbox with a given name is present.
|
static void |
assertCheckboxPresent(String checkboxName,
String checkboxValue)
Assert that a given checkbox is present.
|
static void |
assertCheckboxSelected(String checkBoxName)
Assert that a specific checkbox is selected.
|
static void |
assertCheckboxSelected(String checkBoxName,
String checkBoxValue)
Assert that a specific checkbox is selected.
|
static void |
assertCommentNotPresent(String comment)
Assert that a comment is not present.
|
static void |
assertCommentPresent(String comment)
Assert that a comment is present.
|
static void |
assertCookiePresent(String cookieName)
Checks to see if a cookie is present in the response.
|
static void |
assertCookieValueEquals(String cookieName,
String expectedValue)
Check to see if a cookie has the given value.
|
static void |
assertCookieValueMatch(String cookieName,
String regexp)
Check to see if a cookie value match the given regexp.
|
static void |
assertDownloadedFileEquals(URL expected)
Download the current page (or file) and compare it with the given file.
|
static void |
assertElementNotPresent(String anID)
Assert that an element with a given id is not present.
|
static void |
assertElementNotPresentByXPath(String xpath)
Assert that an element with a given xpath is not present.
|
static void |
assertElementPresent(String anID)
Assert that an element with a given id is present.
|
static void |
assertElementPresentByXPath(String xpath)
Assert that an element with a given xpath is present.
|
static void |
assertFormElementEmpty(String formElementName)
Deprecated.
use an explicit testing method, e.g.
setTextField(String, String) or setHiddenField(String, String) |
static void |
assertFormElementEquals(String formElementName,
String expectedValue)
Deprecated.
use an explicit testing method, e.g.
assertTextFieldEquals(String, String) |
static void |
assertFormElementMatch(String formElementName,
String regexp)
Assert that a specific form element matches an expected regexp.
|
static void |
assertFormElementNotPresent(String formElementName)
Assert that a form input element with a given name is not present.
|
static void |
assertFormElementPresent(String formElementName)
Assert that a form input element with a given name is present.
|
static void |
assertFormNotPresent()
Assert that there is not a form present.
|
static void |
assertFormNotPresent(String nameOrID)
Assert that there is not a form with the specified name or id present.
|
static void |
assertFormPresent()
Assert that there is a form present.
|
static void |
assertFormPresent(String nameOrID)
Assert that there is a form with the specified name or id present.
|
static void |
assertFormPresent(String nameOrID,
int index)
Assert that there is a form with the specified name or id and the given index present.
|
static void |
assertFramePresent(String frameNameOrId)
Assert that a frame with the given name or ID is present.
|
static void |
assertHeaderEquals(String name,
String value)
Assert a header is equal to a particular value.
|
static void |
assertHeaderMatches(String name,
String regexp)
Assert a header matches a particular pattern.
|
static void |
assertHeaderNotPresent(String name)
Assert a header is NOT present.
|
static void |
assertHeaderPresent(String name)
Assert a header is present.
|
static void |
assertHiddenFieldPresent(String formElementName,
String expectedValue)
Assert that an input hidden element with name
formElementName has the expectedValue
value. |
static void |
assertImagePresent(String imageSrc,
String imageAlt)
Assert there is at least one image in the page with given src and (optional) alt attributes.
|
static void |
assertImagePresentPartial(String partialImageSrc,
String partialImageAlt)
Assert there is at least one image in the page with given partial src and (optional) partial alt attributes.
|
static void |
assertImageValid(String imageSrc,
String imageAlt) |
static void |
assertImageValidAndStore(String imageSrc,
String imageAlt,
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.
|
static void |
assertKeyInTable(String tableSummaryOrId,
String key)
Assert that the value of a given web resource is present in a specific table.
|
static void |
assertKeyInTable(String tableSummaryOrId,
String key,
Object[] args)
Assert that the value of a given web resource is present in a specific
table.
|
static void |
assertKeyNotInTable(String tableSummaryOrId,
String key)
Assert that the value of a given web resource is not present in a specific table.
|
static void |
assertKeyNotPresent(String key)
Assert that a web resource's value is not present.
|
static void |
assertKeyNotPresent(String key,
Object[] args)
Assert that a web resource's formatted value is not present.
|
static void |
assertKeyPresent(String key)
Assert that a web resource's value is present.
|
static void |
assertKeyPresent(String key,
Object[] args)
Assert that a web resource's value (with formatting) is present
|
static void |
assertKeysInTable(String tableSummaryOrId,
String[] keys)
Assert that the values of a set of web resources are all present in a specific table.
|
static void |
assertKeysInTable(String tableSummaryOrId,
String[] keys,
Object[][] args)
Assert that the values of a set of web resources are all present in a
specific table.
|
static void |
assertLabeledFieldEquals(String id,
String fieldText)
Assert that a labeled field exists (for the given ID) and the
field that it labels equals the given text
|
static void |
assertLabelMatches(String regexp)
Assert a label exists.
|
static void |
assertLabelPresent(String id)
Assert a label for a given ID exists.
|
static void |
assertLinkNotPresent(String linkId)
Assert that no link with the given id is present in the response.
|
static void |
assertLinkNotPresentWithExactText(String linkText)
Assert that no link containing the Exact text is present.
|
static void |
assertLinkNotPresentWithExactText(String linkText,
int index)
Assert that no link containing the Exact text is present.
|
static void |
assertLinkNotPresentWithImage(String imageFileName)
Assert that a link containing a specified image is not present.
|
static void |
assertLinkNotPresentWithImage(String imageFileName,
int index)
Assert that a link containing a specified image is not present.
|
static void |
assertLinkNotPresentWithText(String linkText)
Assert that no link containing the supplied text is present.
|
static void |
assertLinkNotPresentWithText(String linkText,
int index)
Assert that no link containing the supplied text is present.
|
static void |
assertLinkPresent(String linkId)
Assert that a link with a given id is present in the response.
|
static void |
assertLinkPresentWithExactText(String linkText)
Assert that a link containing the Exact text is present.
|
static void |
assertLinkPresentWithExactText(String linkText,
int index)
Assert that a link containing the Exact text is present.
|
static void |
assertLinkPresentWithImage(String imageFileName)
Assert that a link containing a specified image is present.
|
static void |
assertLinkPresentWithImage(String imageFileName,
int index)
Assert that a link containing a specified image is present.
|
static void |
assertLinkPresentWithText(String linkText)
Assert that a link containing the supplied text is present.
|
static void |
assertLinkPresentWithText(String linkText,
int index)
Assert that a link containing the supplied text is present.
|
static void |
assertMatch(String regexp)
Assert that supplied regexp is matched in the text of a page.
|
static void |
assertMatch(String regexp,
String text)
Assert a given string matches a given regular expression.
|
static void |
assertMatch(String message,
String regexp,
String text)
Assert a given string matches a given regular expression.
|
static void |
assertMatchInElement(String elementID,
String regexp)
Assert that a given element matches a specific regexp.
|
static void |
assertMatchInTable(String tableSummaryNameOrId,
String regexp)
Assert that supplied regexp is matched in a specific table.
|
static void |
assertMatchInTable(String tableSummaryOrId,
String[] regexp)
Assert that a set of regexp values are all matched in a specific table.
|
static void |
assertNoMatch(String regexp)
Assert that supplied regexp is not present.
|
static void |
assertNoMatchInElement(String elementID,
String regexp)
Assert that a given element does not match a specific regexp.
|
static void |
assertNoMatchInTable(String tableSummaryNameOrId,
String regexp)
Assert that supplied regexp is not present in a specific table.
|
static void |
assertNoMatchInTable(String tableSummaryNameOrId,
String[] regexp)
Assert that none of a set of regexp values are present in a specific table.
|
static void |
assertNotMatch(String regexp,
String text)
Assert a given string does not match a given regular expression.
|
static void |
assertNotMatch(String message,
String regexp,
String text)
Assert a given string does not match a given regular expression.
|
static void |
assertRadioOptionNotPresent(String name,
String radioOption)
Assert that a specific option is not present in a radio group.
|
static void |
assertRadioOptionNotSelected(String name,
String radioOption)
Assert that a specific option is not selected in a radio group.
|
static void |
assertRadioOptionPresent(String name,
String radioOption)
Assert that a specific option is present in a radio group.
|
static void |
assertRadioOptionSelected(String name,
String radioOption)
Assert that a specific option is selected in a radio group.
|
static void |
assertResetButtonNotPresent()
Assert that no reset button is present in the current form.
|
static void |
assertResetButtonNotPresent(String buttonName)
Assert that a reset button with a given name is not present.
|
static void |
assertResetButtonPresent()
Assert that a reset button is present.
|
static void |
assertResetButtonPresent(String buttonName)
Assert that a reset button with a given name is present.
|
static void |
assertResponseCode(int status)
Assert that the page response has a particular code.
|
static void |
assertResponseCodeBetween(int lower,
int higher)
Assert that the page response has a particular code between lower and higher
(
lower <= status <= higher ). |
static void |
assertSelectedOptionEquals(String selectName,
int index,
String option)
Assert that the label of the current selected option matches
the provided value in the Nth select element with the specified name.
|
static void |
assertSelectedOptionEquals(String selectName,
String optionLabel)
Assert that the label of the current selected option matches
the provided value.
|
static void |
assertSelectedOptionMatches(String selectName,
int index,
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.
|
static void |
assertSelectedOptionMatches(String selectName,
String regexp)
Assert that the label of the current selected option matches
the provided regular expression value.
|
static void |
assertSelectedOptionsEqual(String selectName,
int index,
String[] labels)
Assert that the currently selected display label(s) of a select box matches given label(s).
|
static void |
assertSelectedOptionsEqual(String selectName,
String[] labels)
Assert that the currently selected display label(s) of a select box matches given label(s).
|
static void |
assertSelectedOptionsMatch(String selectName,
int index,
String[] regexps)
Assert that the currently selected display value(s) of a select box matches a given value(s).
|
static void |
assertSelectedOptionsMatch(String selectName,
String[] regexps)
Assert that the currently selected display value(s) of a select box matches a given value(s).
|
static void |
assertSelectedOptionValueEquals(String selectName,
int index,
String value)
Assert that the currently selected value of a select box matches given value.
|
static void |
assertSelectedOptionValueEquals(String selectName,
String value)
Assert that the currently selected value of a select box matches given value.
|
static void |
assertSelectedOptionValuesEqual(String selectName,
int index,
String[] values)
Assert that the currently selected value(s) of the Nth
select box with the specified name matches given value(s).
|
static void |
assertSelectedOptionValuesEqual(String selectName,
String[] values)
Assert that the currently selected value(s) of a select box matches given value(s).
|
static void |
assertSelectOptionNotPresent(String selectName,
int index,
String optionLabel)
Assert that a specific option is not present in a select box.
|
static void |
assertSelectOptionNotPresent(String selectName,
String optionLabel)
Assert that a specific option is not present in a select box.
|
static void |
assertSelectOptionPresent(String selectName,
int index,
String optionLabel)
Assert that a specific option is present in the Nth select box (by label).
|
static void |
assertSelectOptionPresent(String selectName,
String optionLabel)
Assert that a specific option is present in a select box (by label).
|
static void |
assertSelectOptionsEqual(String selectName,
int index,
String[] expectedOptions)
Assert that the display values of
the Nth select element's options match a given array of strings.
|
static void |
assertSelectOptionsEqual(String selectName,
String[] expectedOptions)
Assert that the display values of a select element's options match a given array of strings.
|
static void |
assertSelectOptionsNotEqual(String selectName,
int index,
String[] expectedOptions)
Assert that the display values of the Nth select element's
options do not match a given array of strings.
|
static void |
assertSelectOptionsNotEqual(String selectName,
String[] expectedOptions)
Assert that the display values of a select element's options do not match a given array of strings.
|
static void |
assertSelectOptionsPresent(String selectName,
int index,
String[] optionLabels)
Assert that given options are present in the Nth select box (by label).
|
static void |
assertSelectOptionsPresent(String selectName,
String[] optionLabels)
Assert that given options are present in a select box (by label).
|
static void |
assertSelectOptionValueNotPresent(String selectName,
int index,
String optionValue)
Assert that a specific option value is not present in a select box.
|
static void |
assertSelectOptionValueNotPresent(String selectName,
String optionValue)
Assert that a specific option value is not present in a select box.
|
static void |
assertSelectOptionValuePresent(String selectName,
int index,
String optionValue)
Assert that a specific option is present in the Nth select box (by value).
|
static void |
assertSelectOptionValuePresent(String selectName,
String optionValue)
Assert that a specific option is present in a select box (by value).
|
static void |
assertSelectOptionValuesEqual(String selectName,
int index,
String[] expectedValues)
Assert that the values of the Nth select element's options match
a given array of strings.
|
static void |
assertSelectOptionValuesEqual(String selectName,
String[] expectedValues)
Assert that the values of a select element's options match a given array of strings.
|
static void |
assertSelectOptionValuesNotEqual(String selectName,
int index,
String[] optionValues)
Assert that the values of the Nth select element's options do not match a
given array of strings.
|
static void |
assertSelectOptionValuesNotEqual(String selectName,
String[] optionValues)
Assert that the values of a select element's options do not match a given array of strings.
|
static void |
assertSelectOptionValuesPresent(String selectName,
int index,
String[] optionValues)
Assert that given options are present in the Nth select box (by value).
|
static void |
assertSelectOptionValuesPresent(String selectName,
String[] optionValues)
Assert that given options are present in a select box (by value).
|
static void |
assertSubmitButtonNotPresent()
Assert that no submit button is present in the current form.
|
static void |
assertSubmitButtonNotPresent(String buttonName)
Assert that a submit button with a given name is not present.
|
static void |
assertSubmitButtonPresent()
Assert that a submit button is present.
|
static void |
assertSubmitButtonPresent(String buttonName)
Assert that a submit button with a given name is present.
|
static void |
assertSubmitButtonPresent(String buttonName,
String buttonValue)
Assert that a submit button with a given name and value is present.
|
static void |
assertTableEquals(String tableSummaryNameOrId,
String[][] expectedCellValues)
Assert that a specific table matches a matrix of supplied text values.
|
static void |
assertTableEquals(String tableSummaryNameOrId,
Table expectedTable)
Assert that a specific table matches an ExpectedTable.
|
static void |
assertTableMatch(String tableSummaryOrId,
String[][] expectedCellValues)
Assert that a specific table matches a matrix of supplied regexps.
|
static void |
assertTableMatch(String tableSummaryOrId,
Table expectedTable)
Assert that a specific table matches an ExpectedTable.
|
static void |
assertTableNotPresent(String tableSummaryNameOrId)
Assert that a table with a given summary or id value is not present.
|
static void |
assertTablePresent(String tableSummaryNameOrId)
Assert that a table with a given summary or id value is present.
|
static void |
assertTableRowCountEquals(String tableSummaryNameOrId,
int expectedRowCount)
Assert that the number of rows for a specific table equals expected value.
|
static void |
assertTableRowsEqual(String tableSummaryNameOrId,
int startRow,
String[][] expectedTable)
Assert that a range of rows for a specific table matches a matrix of supplied text values.
|
static void |
assertTableRowsEqual(String tableSummaryNameOrId,
int startRow,
Table expectedTable)
Assert that a range of rows for a specific table matches a matrix of supplied text values.
|
static void |
assertTableRowsMatch(String tableSummaryOrId,
int startRow,
String[][] expectedTable)
Assert that a range of rows for a specific table matches a matrix of supplied regexps.
|
static void |
assertTableRowsMatch(String tableSummaryOrId,
int startRow,
Table expectedTable)
Assert that a range of rows for a specific table matches a matrix of supplied regexps.
|
static void |
assertTextFieldEquals(String formElementName,
String expectedValue)
Assert that an input text element with name
formElementName has the expectedValue
value. |
static void |
assertTextInElement(String elementID,
String text)
Assert that a given element contains specific text.
|
static void |
assertTextInTable(String tableSummaryNameOrId,
String text)
Assert that supplied text is present in a specific table.
|
static void |
assertTextInTable(String tableSummaryOrId,
String[] text)
Assert that a set of text values are all present in a specific table.
|
static void |
assertTextNotInElement(String elementID,
String text) |
static void |
assertTextNotInTable(String tableSummaryNameOrId,
String text)
Assert that supplied text is not present in a specific table.
|
static void |
assertTextNotInTable(String tableSummaryNameOrId,
String[] text)
Assert that none of a set of text values are present in a specific table.
|
static void |
assertTextNotPresent(String text)
Assert that supplied text is not present.
|
static void |
assertTextPresent(String text)
Assert that supplied text is present.
|
static void |
assertTitleEquals(String title)
Assert title of current html page in conversation matches an expected
value.
|
static void |
assertTitleEqualsKey(String titleKey)
Assert title of current html page matches the value of a specified web
resource.
|
static void |
assertTitleEqualsKey(String titleKey,
Object[] args)
Assert title of current page matches formatted message resource
|
static void |
assertTitleMatch(String regexp)
Assert title of current html page in conversation matches an expected regexp.
|
static void |
assertTitleNotEquals(String title)
Assert title of current html page in conversation is not
equal to another value.
|
static void |
assertTitleNotSame(String title)
Deprecated.
Replaced by
assertTitleNotEquals(String) |
static void |
assertWindowCountEquals(int windowCount)
Assert that the number of opened windows equals given value.
|
static void |
assertWindowPresent(int windowID)
Assert that a window with the given ID is open.
|
static void |
assertWindowPresent(String windowName)
Assert that a window with the given name is open.
|
static void |
assertWindowPresentWithTitle(String title)
Assert that at least one window with the given title is open.
|
static void |
beginAt(String aRelativeURL)
Begin conversation at a URL absolute or relative to base URL.
|
static void |
checkCheckbox(String checkBoxName)
Select a specified checkbox.
|
static void |
checkCheckbox(String checkBoxName,
String value)
Select a specified checkbox.
|
static void |
clickButton(String buttonId)
Click the button with the given id.
|
static void |
clickButtonWithText(String buttonValueText)
Clicks a button with
text of the value attribute. |
static void |
clickElementByXPath(String xpath)
Click element with given xpath.
|
static void |
clickLink(String linkId)
Navigate by selection of a link with given id.
|
static void |
clickLinkWithExactText(String linkText)
Navigate by selection of a link with the exact given text.
|
static void |
clickLinkWithExactText(String linkText,
int index)
Navigate by selecting Nth link with the exact given text.
|
static void |
clickLinkWithImage(String imageFileName)
Navigate by selection of a link with a given image.
|
static void |
clickLinkWithImage(String imageFileName,
int index)
Navigate by selection of a link with a given image.
|
static void |
clickLinkWithText(String linkText)
Navigate by selection of a link containing given text.
|
static void |
clickLinkWithText(String linkText,
int index)
Navigate by selecting Nth link containing given text.
|
static void |
clickRadioOption(String radioGroup,
String radioOption)
Clicks a radio option.
|
static void |
closeBrowser()
Close the current conversation.
|
static void |
closeWindow()
Close the current window.
|
static void |
dumpCookies()
Print all the cookies to stdout.
|
static void |
dumpHtml()
Deprecated.
|
static void |
dumpHtml(PrintStream stream)
Deprecated.
|
static void |
dumpTable(String tableNameOrId)
Dump the table as the 2D array that is used for assertions - for debugging purposes.
|
static void |
dumpTable(String tableNameOrId,
PrintStream stream)
Dump the table as the 2D array that is used for assertions - for debugging purposes.
|
static Map<String,String> |
getAllHeaders()
Deprecated.
This method do not deal with several headers with same name. Use
getResponseHeaders() instead. |
static List<String> |
getComments()
Get all the comments in a document, as a list of strings.
|
static ITestingEngine |
getDialog()
Deprecated.
You should not use plugin specific functionality. Please ask for a new core feature instead.
|
static String |
getElementAttributByXPath(String xpath,
String attribute)
Deprecated.
|
static String |
getElementAttributeByXPath(String xpath,
String attribute)
Get the attribute value of the given element.
|
static IElement |
getElementById(String id)
Get an element for a particular ID.
|
static IElement |
getElementByXPath(String xpath)
Get an element for a particular xpath.
|
static List<IElement> |
getElementsByXPath(String xpath)
Get elements for a particular xpath.
|
static String |
getElementTextByXPath(String xpath)
Get text of the given element.
|
static List<IElement> |
getFieldsForLabel(IElement label)
Get all the fields of type
input , textarea or select
that are referenced or contained in a particular label. |
static String |
getFormElementValue(String formElementName)
Deprecated.
|
static String |
getHeader(String name)
Get a particular header value.
|
static Image |
getImage(String imageSrc,
String imageAlt) |
static String |
getLabeledFieldValue(String identifier,
IElement label)
Get the current value of a given labelled field.
|
static String |
getMessage(String key)
Return the value of a web resource based on its key.
|
static String |
getMessage(String key,
Object[] args)
Return the value of a web resource based on its key, using MessageFormat
to perform parametric substitution with formatting.
|
static String |
getPageSource()
Get the source of the HTML page (like in a real browser), or HTTP body for a non HTML content.
|
static List<HttpHeader> |
getResponseHeaders()
Return all HTTP headers that are in last response.
|
static String |
getServerResponse()
Get the last data sent by the server.
|
static String |
getServeurResponse()
Deprecated.
|
static Table |
getTable(String tableSummaryNameOrId) |
static TestContext |
getTestContext()
Provide access to test testContext.
|
static WebTester |
getTester()
Get internal WebTester.
|
static ITestingEngine |
getTestingEngine()
Protected version of deprecated getDialog().
|
static String |
getTestingEngineKey()
Gets the Testing Engine Key that is used to find the proper testing engine class (HtmlUnitDialog /
SeleniumDialog) for the tests.
|
static void |
gotoFrame(String frameNameOrId)
Make the given frame active.
|
static void |
gotoPage(String url)
Go to the given page like if user has typed the URL manually in the browser.
|
static void |
gotoRootWindow()
Make the root window active.
|
static void |
gotoWindow(int windowID)
Deprecated.
Javascript ID does'nt not exists. Currently this is an index
in the list of available windows, but this is not portable (and probably not stable).
Use
gotoWindow(String) or gotoWindowByTitle(String) instead. |
static void |
gotoWindow(String windowName)
Make a given window active.
|
static void |
gotoWindowByTitle(String title)
Make first window with the given title active.
|
static boolean |
hasElementById(String id)
Returns
true if an element with the given ID exists. |
static boolean |
hasElementByXPath(String xpath)
Return
true if the given element by XPath exists. |
static boolean |
hasElementsByXPath(String xpath)
Return
true if the given elements by XPath exists. |
static void |
reset()
Reset the current form using the default reset button.
|
static void |
saveAs(File f)
Save the last downloaded page (or file) to the disk.
|
static void |
selectOption(String selectName,
int index,
String label)
Select an option with a given display label in Nth select element.
|
static void |
selectOption(String selectName,
String label)
Select an option with a given display label in a select element.
|
static void |
selectOptionByValue(String selectName,
int index,
String value)
Select an option with a given value in a select element.
|
static void |
selectOptionByValue(String selectName,
String value)
Select an option with a given value in the Nth select element.
|
static void |
selectOptions(String selectName,
int index,
String[] labels)
Select options with given display labels in the Nth select element.
|
static void |
selectOptions(String selectName,
String[] labels)
Select options with given display labels in a select element.
|
static void |
selectOptionsByValues(String selectName,
int index,
String[] values)
Select options with given values in the Nth select element.
|
static void |
selectOptionsByValues(String selectName,
String[] values)
Select options with given values in a select element.
|
static void |
setBaseUrl(String url)
Set the base url for the test context.
|
static void |
setBaseUrl(URL url)
Set the base url for the test context.
|
static void |
setCustomTester(WebTester tester)
Set a custom WebTester (for example your own subclass).
|
static void |
setDialog(ITestingEngine aIJWebUnitDialog)
Set the testing engine.
|
static void |
setExpectedJavaScriptAlert(String message)
Tell that the given alert box is expected.
|
static void |
setExpectedJavaScriptAlert(String[] messages)
Tell that the given alert boxes are expected in the given order.
|
static void |
setExpectedJavaScriptConfirm(String[] messages,
boolean[] actions)
Tell that the given confirm boxes are expected in the given order.
|
static void |
setExpectedJavaScriptConfirm(String message,
boolean action)
Tell that the given confirm boxe is expected.
|
static void |
setExpectedJavaScriptPrompt(String[] messages,
String[] inputs)
Tell that the given prompt boxes are expected in the given order.
|
static void |
setExpectedJavaScriptPrompt(String message,
String input)
Tell that the given prompt boxe is expected.
|
static void |
setFormElement(String formElementName,
String value)
Deprecated.
use
setTextField(String, String) or other methods |
static void |
setHiddenField(String inputName,
String value)
Set the value of an hidden input field.
|
static void |
setIgnoreFailingStatusCodes(boolean ignore)
Should the tester ignore failing status codes (300+)?
|
static void |
setLabeledFormElementField(String id,
String value) |
static void |
setScriptingEnabled(boolean value)
Enable or disable Javascript support
|
static void |
setTestContext(TestContext aTestContext)
Allows setting an external test testContext class that might be extended from TestContext.
|
static void |
setTestingEngineKey(String testingEngineKey)
Set the Testing Engine that you want to use for the tests based on the Testing Engine Key.
|
static void |
setTextField(String inputName,
String value)
Set the value of a text or password input field.
|
static void |
setTimeout(int milli)
Set the timeout for the request.
|
static void |
setWorkingForm(int index)
Begin interaction with a specified form.
|
static void |
setWorkingForm(String nameOrId)
Begin interaction with a specified form.
|
static void |
setWorkingForm(String nameOrId,
int index)
Begin interaction with a specified form.
|
static void |
submit()
Submit form - default submit button will be used (unnamed submit button, or named button if there is only one on
the form.
|
static void |
submit(String buttonName)
Submit form by pressing named button.
|
static void |
submit(String buttonName,
String buttonValue)
Submit the form by pressing the named button with the given value (label).
|
static void |
uncheckCheckbox(String checkBoxName)
Deselect a specified checkbox.
|
static void |
uncheckCheckbox(String checkBoxName,
String value)
Deselect a specified checkbox.
|
public static WebTester getTester()
public static void setCustomTester(WebTester tester)
public static ITestingEngine getDialog()
public static void setBaseUrl(String url)
url
- Base url value - A trailing "/" is appended if not provided.public static void setBaseUrl(URL url)
url
- Base url value - A trailing "/" is appended if not provided.public static ITestingEngine getTestingEngine()
public static void closeBrowser()
public static void closeWindow()
public static void setDialog(ITestingEngine aIJWebUnitDialog)
aIJWebUnitDialog
- Testing engine.public static TestContext getTestContext()
public static void setTestContext(TestContext aTestContext)
aTestContext
- public static void beginAt(String aRelativeURL) throws TestingEngineResponseException
getTestContext().setBaseUrl(String)
to define base URL. Absolute URL
should start with "http://", "https://" or "www.".url
- absolute or relative URL (relative to base URL).TestingEngineResponseException
- If something bad happend (404)public static String getMessage(String key)
key
- name of the web resource.public static String getMessage(String key, Object[] args)
key
- name of the web resource.args
- array of arguments to be formatted into messageMessageFormat
public static void assertResponseCode(int status)
status
- the expected status codepublic static void assertResponseCodeBetween(int lower, int higher)
lower <= status <= higher
).lower
- the lower bound for the expected status codehigher
- the upper bound for the expected status codepublic static void setIgnoreFailingStatusCodes(boolean ignore)
ignore
- public static void assertHeaderPresent(String name)
name
- The header to findpublic static void assertHeaderNotPresent(String name)
name
- The header to findpublic static void assertHeaderEquals(String name, String value)
name
- Header to findvalue
- Value to compare againstpublic static void assertHeaderMatches(String name, String regexp)
name
- Header to findregexp
- Pattern to compare againstpublic static String getHeader(String name)
name
- Header to find@Deprecated public static Map<String,String> getAllHeaders()
getResponseHeaders()
instead.public static List<HttpHeader> getResponseHeaders()
HttpHeader
elements.public static void assertTitleEquals(String title)
title
- expected title value@Deprecated public static void assertTitleNotSame(String title)
assertTitleNotEquals(String)
title
- unexpected title valuepublic static void assertTitleNotEquals(String title)
title
- unexpected title valuepublic static void assertTitleMatch(String regexp)
regexp
- expected title regexppublic static void assertTitleEqualsKey(String titleKey)
titleKey
- web resource key for titlepublic static void assertTitleEqualsKey(String titleKey, Object[] args)
titleKey
- args
- public static void assertKeyPresent(String key)
key
- web resource namepublic static void assertKeyPresent(String key, Object[] args)
key
- args
- public static void assertTextPresent(String text)
text
- public static void assertMatch(String regexp)
regexp
- public static void assertMatch(String regexp, String text)
regexp
- text
- public static void assertNotMatch(String regexp, String text)
regexp
- text
- public static void assertMatch(String message, String regexp, String text)
regexp
- text
- public static void assertNotMatch(String message, String regexp, String text)
regexp
- text
- public static void assertKeyNotPresent(String key)
key
- web resource namepublic static void assertKeyNotPresent(String key, Object[] args)
key
- web resource namepublic static void assertTextNotPresent(String text)
text
- public static void assertNoMatch(String regexp)
regexp
- public static Table getTable(String tableSummaryNameOrId)
tableSummaryNameOrId
- public static void assertTablePresent(String tableSummaryNameOrId)
tableSummaryNameOrId
- summary, name or id attribute value of tablepublic static void assertTableNotPresent(String tableSummaryNameOrId)
tableSummaryNameOrId
- summary, name or id attribute value of tablepublic static void assertKeyInTable(String tableSummaryOrId, String key)
tableSummaryOrId
- summary or id attribute value of tablekey
- web resource namepublic static void assertKeyInTable(String tableSummaryOrId, String key, Object[] args)
tableSummaryOrId
- summary or id attribute value of tablekey
- web resource namepublic static void assertTextInTable(String tableSummaryNameOrId, String text)
tableSummaryNameOrId
- summary, name or id attribute value of tabletext
- public static void assertMatchInTable(String tableSummaryNameOrId, String regexp)
tableSummaryNameOrId
- summary, name or id attribute value of tableregexp
- public static void assertKeysInTable(String tableSummaryOrId, String[] keys)
tableSummaryOrId
- summary, name or id attribute value of tablekeys
- Array of web resource names.public static void assertKeysInTable(String tableSummaryOrId, String[] keys, Object[][] args)
tableSummaryOrId
- summary or id attribute value of tablekeys
- Array of web resource names.public static void assertTextInTable(String tableSummaryOrId, String[] text)
tableSummaryOrId
- summary, name or id attribute value of tabletext
- Array of expected text values.public static void assertMatchInTable(String tableSummaryOrId, String[] regexp)
tableSummaryOrId
- summary, name or id attribute value of tabletext
- Array of expected regexps to match.public static void assertKeyNotInTable(String tableSummaryOrId, String key)
tableSummaryOrId
- summary, name or id attribute value of tablekey
- web resource namepublic static void assertTextNotInTable(String tableSummaryNameOrId, String text)
tableSummaryNameOrId
- summary, name or id attribute value of tabletext
- public static void assertTextNotInTable(String tableSummaryNameOrId, String[] text)
tableSummaryNameOrId
- summary, name or id attribute value of tabletext
- Array of text valuespublic static void assertNoMatchInTable(String tableSummaryNameOrId, String regexp)
tableSummaryNameOrId
- summary, name or id attribute value of tabletext
- public static void assertNoMatchInTable(String tableSummaryNameOrId, String[] regexp)
tableSummaryNameOrId
- summary, name or id attribute value of tabletext
- Array of text valuespublic static void assertTableEquals(String tableSummaryNameOrId, Table expectedTable)
tableSummaryNameOrId
- summary, name or id attribute value of tableexpectedTable
- represents expected values (colspan supported).public static void assertTableEquals(String tableSummaryNameOrId, String[][] expectedCellValues)
tableSummaryNameOrId
- summary, name or id attribute value of tableexpectedCellValues
- double dimensional array of expected valuespublic static void assertTableRowsEqual(String tableSummaryNameOrId, int startRow, Table expectedTable)
tableSummaryNameOrId
- summary, name or id attribute value of tablestartRow
- index of start row for comparisonexpectedTable
- represents expected values (colspan and rowspan supported).public static void assertTableRowsEqual(String tableSummaryNameOrId, int startRow, String[][] expectedTable)
tableSummaryNameOrId
- summary, name or id attribute value of tablestartRow
- index of start row for comparisonexpectedTable
- represents expected values (colspan and rowspan supported).public static void assertTableRowCountEquals(String tableSummaryNameOrId, int expectedRowCount)
tableSummaryNameOrId
- summary, name or id attribute value of tableexpectedRowCount
- expected row count.public static void assertTableMatch(String tableSummaryOrId, Table expectedTable)
tableSummaryOrId
- summary or id attribute value of tableexpectedTable
- represents expected regexps (colspan supported).public static void assertTableMatch(String tableSummaryOrId, String[][] expectedCellValues)
tableSummaryOrId
- summary or id attribute value of tableexpectedCellValues
- double dimensional array of expected regexpspublic static void assertTableRowsMatch(String tableSummaryOrId, int startRow, Table expectedTable)
tableSummaryOrId
- summary or id attribute value of tablestartRow
- index of start row for comparisonexpectedTable
- represents expected regexps (colspan and rowspan supported).public static void assertTableRowsMatch(String tableSummaryOrId, int startRow, String[][] expectedTable)
tableSummaryOrId
- summary or id attribute value of tablestartRow
- index of start row for comparisonexpectedTable
- represents expected regexps (colspan and rowspan not supported).public static void assertFormElementPresent(String formElementName)
formElementName
- public static void assertFormElementNotPresent(String formElementName)
formElementName
- public static void assertCheckboxPresent(String checkboxName)
checkboxName
- checkbox name.public static void assertCheckboxPresent(String checkboxName, String checkboxValue)
checkboxName
- checkbox name attribut.checkboxValue
- checkbox value attribut.public static void assertCheckboxNotPresent(String checkboxName)
checkboxName
- checkbox name.public static void assertCheckboxNotPresent(String checkboxName, String checkboxValue)
checkboxName
- checkbox name.checkboxValue
- checkbox value attribut.public static void assertFormPresent()
public static void assertFormPresent(String nameOrID)
nameOrID
- public static void assertFormPresent(String nameOrID, int index)
nameOrID
- index
- The 0-based index, when more than one form with the same name is expected.public static void assertFormNotPresent()
public static void assertFormNotPresent(String nameOrID)
nameOrID
- public static void assertFormElementEquals(String formElementName, String expectedValue)
assertTextFieldEquals(String, String)
formElementName
- expectedValue
- assertTextFieldEquals(String, String)
public static void assertFormElementMatch(String formElementName, String regexp)
formElementName
- regexp
- public static void assertFormElementEmpty(String formElementName)
setTextField(String, String)
or setHiddenField(String, String)
formElementName
- setTextField(String, String)
,
setHiddenField(String, String)
public static void assertTextFieldEquals(String formElementName, String expectedValue)
formElementName
has the expectedValue
value.formElementName
- the value of the name attribute of the elementexpectedValue
- the expected value of the given input elementpublic static void assertHiddenFieldPresent(String formElementName, String expectedValue)
formElementName
has the expectedValue
value.formElementName
- the value of the name attribute of the elementexpectedValue
- the expected value of the given input elementpublic static void assertCheckboxSelected(String checkBoxName)
checkBoxName
- public static void assertCheckboxSelected(String checkBoxName, String checkBoxValue)
checkBoxName
- checkBoxValue
- public static void assertCheckboxNotSelected(String checkBoxName)
checkBoxName
- public static void assertCheckboxNotSelected(String checkBoxName, String checkBoxValue)
checkBoxName
- checkBoxValue
- public static void assertRadioOptionPresent(String name, String radioOption)
name
- radio group name.radioOption
- option to test for.public static void assertRadioOptionNotPresent(String name, String radioOption)
name
- radio group name.radioOption
- option to test for.public static void assertRadioOptionSelected(String name, String radioOption)
name
- radio group name.radioOption
- option to test for selection.public static void assertRadioOptionNotSelected(String name, String radioOption)
name
- radio group name.radioOption
- option to test for selection.public static void assertSelectOptionsPresent(String selectName, String[] optionLabels)
selectName
- name of the select element.optionLabels
- option labels.public static void assertSelectOptionPresent(String selectName, String optionLabel)
selectName
- name of the select element.optionLabel
- option label.public static void assertSelectOptionsPresent(String selectName, int index, String[] optionLabels)
selectName
- name of the select element.index
- the 0-based index of the select element when multiple
select elements are expected.optionLabels
- option labels.public static void assertSelectOptionPresent(String selectName, int index, String optionLabel)
selectName
- name of the select element.index
- the 0-based index of the select element when multiple
select elements are expected.optionLabel
- option label.public static void assertSelectOptionValuesPresent(String selectName, String[] optionValues)
selectName
- name of the select element.optionValues
- option labels.public static void assertSelectOptionValuePresent(String selectName, String optionValue)
selectName
- name of the select element.optionValue
- option value.public static void assertSelectOptionValuesPresent(String selectName, int index, String[] optionValues)
selectName
- name of the select element.index
- the 0-based index of the select element when multiple
select elements are expected.optionValues
- option labels.public static void assertSelectOptionValuePresent(String selectName, int index, String optionValue)
selectName
- name of the select element.index
- the 0-based index of the select element when multiple
select elements are expected.optionValue
- option value.public static void assertSelectOptionValueNotPresent(String selectName, String optionValue)
selectName
- name of the select element.optionValue
- option value.public static void assertSelectOptionNotPresent(String selectName, String optionLabel)
selectName
- name of the select element.expectedOption
- option label.public static void assertSelectOptionValueNotPresent(String selectName, int index, String optionValue)
selectName
- name of the select element.optionValue
- option value.public static void assertSelectOptionNotPresent(String selectName, int index, String optionLabel)
selectName
- name of the select element.expectedOption
- option label.public static void assertSelectOptionsEqual(String selectName, String[] expectedOptions)
selectName
- name of the select element.expectedOptions
- expected labels for the select box.public static void assertSelectOptionsEqual(String selectName, int index, String[] expectedOptions)
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.public static void assertSelectOptionsNotEqual(String selectName, String[] expectedOptions)
selectName
- name of the select element.expectedOptions
- expected display values for the select box.public static void assertSelectOptionsNotEqual(String selectName, int index, String[] expectedOptions)
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.public static void assertSelectOptionValuesEqual(String selectName, int index, String[] expectedValues)
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.public static void assertSelectOptionValuesEqual(String selectName, String[] expectedValues)
selectName
- name of the select element.expectedValues
- expected values for the select box.public static void assertSelectOptionValuesNotEqual(String selectName, String[] optionValues)
selectName
- name of the select element.optionValues
- expected values for the select box.public static void assertSelectOptionValuesNotEqual(String selectName, int index, String[] optionValues)
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.public static void assertSelectedOptionsEqual(String selectName, String[] labels)
selectName
- name of the select element.labels
- expected display label(s) of the selected option.public static void assertSelectedOptionsEqual(String selectName, int index, String[] labels)
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.public static void assertSelectedOptionEquals(String selectName, String optionLabel)
selectName
- name of the select elementoptionLabel
- expected value of the option labelpublic static void assertSelectedOptionEquals(String selectName, int index, String option)
selectName
- name of the select elementindex
- the 0-based index used when more than one select element
with the same name is expected.optionLabel
- expected value of the option labelpublic static void assertSelectedOptionValuesEqual(String selectName, String[] values)
selectName
- name of the select element.values
- expected value(s) of the selected option.public static void assertSelectedOptionValuesEqual(String selectName, int index, String[] values)
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.public static void assertSelectedOptionValueEquals(String selectName, String value)
selectName
- name of the select element.value
- expected value of the selected option.public static void assertSelectedOptionValueEquals(String selectName, int index, String value)
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.public static void assertSelectedOptionsMatch(String selectName, String[] regexps)
selectName
- name of the select element.regexps
- expected display value of the selected option.public static void assertSelectedOptionsMatch(String selectName, int index, String[] regexps)
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.public static void assertSelectedOptionMatches(String selectName, String regexp)
selectName
- name of the select elementregexp
- the regular expression to matchpublic static void assertSelectedOptionMatches(String selectName, int index, String regexp)
selectName
- name of the select elementindex
- the 0-based index used when more than one select element
with the same name is expected.regexp
- the regular expression to matchpublic static void assertSubmitButtonPresent()
public static void assertSubmitButtonPresent(String buttonName)
buttonName
- public static void assertSubmitButtonNotPresent()
buttonName
- public static void assertSubmitButtonNotPresent(String buttonName)
buttonName
- public static void assertSubmitButtonPresent(String buttonName, String buttonValue)
buttonName
- buttonValue
- public static void assertResetButtonPresent()
public static void assertResetButtonPresent(String buttonName)
buttonName
- public static void assertResetButtonNotPresent()
buttonName
- public static void assertResetButtonNotPresent(String buttonName)
buttonName
- public static void assertButtonPresent(String buttonId)
buttonId
- public static void assertButtonPresentWithText(String text)
text
- Text representation of button content.public static void assertButtonNotPresentWithText(String text)
text
- Text representation of button content.public static void assertButtonNotPresent(String buttonId)
buttonId
- public static void assertLinkPresent(String linkId)
linkId
- public static void assertLinkNotPresent(String linkId)
linkId
- public static void assertLinkPresentWithText(String linkText)
linkText
- public static void assertLinkNotPresentWithText(String linkText)
linkText
- public static void assertLinkPresentWithText(String linkText, int index)
linkText
- index
- The 0-based index, when more than one link with the same text is expected.public static void assertLinkNotPresentWithText(String linkText, int index)
linkText
- index
- The 0-based index, when more than one link with the same text is expected.public static void assertLinkPresentWithExactText(String linkText)
linkText
- public static void assertLinkNotPresentWithExactText(String linkText)
linkText
- public static void assertLinkPresentWithExactText(String linkText, int index)
linkText
- index
- The 0-based index, when more than one link with the same text is expected.public static void assertLinkNotPresentWithExactText(String linkText, int index)
linkText
- index
- The 0-based index, when more than one link with the same text is expected.public static void assertLinkPresentWithImage(String imageFileName)
imageFileName
- A suffix of the image's filename; for example, to match "images/my_icon.png",
you could just pass in "my_icon.png".public static void assertLinkPresentWithImage(String imageFileName, int index)
imageFileName
- A suffix of the image's filename; for example, to match "images/my_icon.png",
you could just pass in "my_icon.png".index
- The 0-based index, when more than one link with the same image is expected.public static void assertLinkNotPresentWithImage(String imageFileName)
imageFileName
- A suffix of the image's filename; for example, to match "images/my_icon.png",
you could just pass in "my_icon.png".public static void assertLinkNotPresentWithImage(String imageFileName, int index)
imageFileName
- A suffix of the image's filename; for example, to match "images/my_icon.png",
you could just pass in "my_icon.png".index
- The 0-based index, when more than one link with the same image is expected.public static void assertElementPresent(String anID)
anID
- element id to test for.public static void assertElementNotPresent(String anID)
anID
- element id to test for.public static void assertElementPresentByXPath(String xpath)
xpath
- element xpath to test for.public static void assertElementNotPresentByXPath(String xpath)
xpath
- element xpath to test for.public static List<String> getComments()
public static void assertCommentPresent(String comment)
comment
- public static void assertCommentNotPresent(String comment)
comment
- public static void assertTextInElement(String elementID, String text)
elementID
- id of element to be inspected.text
- to check for.public static void assertMatchInElement(String elementID, String regexp)
elementID
- id of element to be inspected.regexp
- to match.public static void assertNoMatchInElement(String elementID, String regexp)
elementID
- id of element to be inspected.regexp
- to match.public static void assertWindowPresent(String windowName)
windowName
- public static void assertWindowPresent(int windowID)
windowID
- Javascript window ID.public static void assertWindowPresentWithTitle(String title)
title
- public static void assertWindowCountEquals(int windowCount)
windowCount
- Window countpublic static void assertFramePresent(String frameNameOrId)
frameNameOrId
- Name or ID of the frame. ID is checked first.public static void assertCookiePresent(String cookieName)
cookieName
- The cookie namepublic static void assertCookieValueEquals(String cookieName, String expectedValue)
cookieName
- The cookie nameexpectedValue
- The cookie valuepublic static void assertCookieValueMatch(String cookieName, String regexp)
cookieName
- The cookie nameregexp
- The regexppublic static String getFormElementValue(String formElementName)
WebTester.getElementAttributeByXPath(String, String)
public static void setWorkingForm(int index)
index
- 0-based index of the form to work with.public static void setWorkingForm(String nameOrId)
nameOrId
- name or id of the form to work with.public static void setWorkingForm(String nameOrId, int index)
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.public static void setTextField(String inputName, String value)
inputName
- name of form element.value
- value to set.public static void setHiddenField(String inputName, String value)
inputName
- name of form element.value
- value to set.public static void checkCheckbox(String checkBoxName)
checkBoxName
- name of checkbox to be selected.public static void checkCheckbox(String checkBoxName, String value)
checkBoxName
- name of checkbox to be selected.value
- value of checkbox to be selected.public static void uncheckCheckbox(String checkBoxName)
checkBoxName
- name of checkbox to be deselected.public static void uncheckCheckbox(String checkBoxName, String value)
checkBoxName
- name of checkbox to be deselected.value
- value of checkbox to be deselected.public static void selectOptions(String selectName, String[] labels)
selectName
- name of select element.labels
- labels of options to be selected.public static void selectOption(String selectName, String label)
selectName
- name of select element.label
- label of option to be selected.public static void selectOption(String selectName, int index, String label)
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.public static void selectOptions(String selectName, int index, String[] labels)
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.public static void selectOptionsByValues(String selectName, String[] values)
selectName
- name of select element.values
- values of options to be selected.public static void selectOptionByValue(String selectName, String value)
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.public static void selectOptionsByValues(String selectName, int index, String[] values)
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.public static void selectOptionByValue(String selectName, int index, String value)
selectName
- name of select element.values
- values of options to be selected.public static void submit()
public static void submit(String buttonName)
buttonName
- Submit button name attribut value.public static void submit(String buttonName, String buttonValue)
buttonName
- Submit button name attribut value.buttonValue
- Submit button value attribut value.public static void reset()
#getForm
for an explanation of how the current
form is established.public static void clickLinkWithText(String linkText)
linkText
- Text in the link.public static void clickLinkWithText(String linkText, int index)
linkText
- Text in the link.index
- The 0-based index, when more than one link with the same text is expected.public static void clickLinkWithExactText(String linkText)
linkText
- Text of the link.public static void clickLinkWithExactText(String linkText, int index)
linkText
- Text of the link.index
- The 0-based index, when more than one link with the same text is expected.public static void clickButton(String buttonId)
buttonId
- Button ID attribut value.public static void clickButtonWithText(String buttonValueText)
text
of the value attribute.buttonValueText
- The text of the button (contents of the value attribute).public static void clickLinkWithImage(String imageFileName)
imageFileName
- A suffix of the image's filename; for example, to match "images/my_icon.png",
you could just pass in "my_icon.png".public static void clickLinkWithImage(String imageFileName, int index)
imageFileName
- A suffix of the image's filename; for example, to match "images/my_icon.png",
you could just pass in "my_icon.png".index
- The 0-based index, when more than one link with the same image is expected.public static void clickLink(String linkId)
linkId
- id of linkpublic static void clickRadioOption(String radioGroup, String radioOption)
radioGroup
- name of the radio group.radioOption
- value of the option to check for.public static void clickElementByXPath(String xpath)
xpath
- xpath of the element.public static String getElementAttributeByXPath(String xpath, String attribute)
<img src="test.gif" alt="picture">
getElementAttributeByXPath("//img[@src='test.gif']", "alt") returns "picture".xpath
- XPath of the elementattribute
- Name of the attributepublic static String getElementAttributByXPath(String xpath, String attribute)
getElementAttributeByXPath(String, String)
public static String getElementTextByXPath(String xpath)
xpath
- xpath of the element.public static IElement getElementByXPath(String xpath)
xpath
- XPath to searchAssertionError
- if the element xpath is not foundpublic static boolean hasElementByXPath(String xpath)
true
if the given element by XPath exists.xpath
- XPath to searchtrue
if the the requested elementAssertionError
- if the element xpath is not foundpublic static IElement getElementById(String id)
id
- element ID to findAssertionError
- if the element is not foundpublic static boolean hasElementById(String id)
true
if an element with the given ID exists.id
- element ID to findtrue
if the element ID exists, false
otherwisepublic static List<IElement> getElementsByXPath(String xpath)
xpath
- XPath to searchpublic static boolean hasElementsByXPath(String xpath)
true
if the given elements by XPath exists.xpath
- XPath to searchtrue
if the given elements by XPath existpublic static void assertLabelPresent(String id)
public static void assertLabelMatches(String regexp)
public static List<IElement> getFieldsForLabel(IElement label)
input
, textarea
or select
that are referenced or contained in a particular label.label
- The label to considerpublic static String getLabeledFieldValue(String identifier, IElement label)
identifier
- the HTML ID for the given labelled fieldlabel
- the label found for the given HTML IDnull
if none was foundpublic static void assertLabeledFieldEquals(String id, String fieldText)
id
- the HTML ID for the given labelled fieldfieldText
- the text that the field's value should equal#getLabeledFieldValue(String, IElement, String)
,
#getLabel(String)
public static void gotoWindow(String windowName)
windowName
- Name of the window.@Deprecated public static void gotoWindow(int windowID)
gotoWindow(String)
or gotoWindowByTitle(String)
instead.windowID
- Javascript ID of the windowpublic static void gotoRootWindow()
ITestingEngine.gotoFrame(String)
.public static void gotoWindowByTitle(String title)
title
- Title of the window.public static void gotoFrame(String frameNameOrId)
frameNameOrId
- Name or ID of the frame. ID is checked first.public static void gotoPage(String url) throws TestingEngineResponseException
getTestContext().setBaseUrl(String)
to define base URL. Absolute URL
should start with "http://", "https://" or "www.".url
- absolute or relative URL (relative to base URL).TestingEngineResponseException
- If something bad happend (404)public static void dumpCookies()
public static String getPageSource()
public static String getServerResponse()
public static String getServeurResponse()
getServerResponse()
public static void saveAs(File f)
f
- The file name.public static void assertDownloadedFileEquals(URL expected)
expected
- Expected file URL.public static void dumpHtml()
WebTester.getPageSource()
stream
- public static void dumpHtml(PrintStream stream)
WebTester.getPageSource()
stream
- public static void dumpTable(String tableNameOrId)
tableNameOrId
- stream
- public static void dumpTable(String tableNameOrId, PrintStream stream)
tableNameOrId
- table
- stream
- public static void setScriptingEnabled(boolean value)
public static void setTestingEngineKey(String testingEngineKey)
testingEngineKey
- The testingEngineKey to set.TestingEngineRegistry
public static String getTestingEngineKey()
public static void setFormElement(String formElementName, String value)
setTextField(String, String)
or other methodsformElementName
- name of form element.value
- setTextField(String, String)
public static void setExpectedJavaScriptAlert(String message)
message
- Message in the alert.public static void setExpectedJavaScriptAlert(String[] messages)
messages
- Messages in the alerts.public static void setExpectedJavaScriptConfirm(String message, boolean action)
message
- Message in the confirm.action
- Whether we should click on "OK" (true) or "Cancel" (false)public static void setExpectedJavaScriptConfirm(String[] messages, boolean[] actions)
messages
- Messages in the confirms.actions
- Whether we should click on "OK" (true) or "Cancel" (false)public static void setExpectedJavaScriptPrompt(String message, String input)
message
- Message in the prompt.input
- What we should put in the prompt (null if user press Cancel)public static void setExpectedJavaScriptPrompt(String[] messages, String[] inputs)
messages
- Messages in the prompts.inputs
- What we should put in the prompt (null if user press Cancel)public static void assertImagePresent(String imageSrc, String imageAlt)
imageSrc
- Value of image src attribute.imageAlt
- Value of image alt attribute. Ignored when null.public static void assertImagePresentPartial(String partialImageSrc, String partialImageAlt)
partialImageSrc
- partialImageAlt
- public static void assertImageValidAndStore(String imageSrc, String imageAlt, File out)
imageSrc
- as it appears in the html page, i.e. relative to the current page.public static void setTimeout(int milli)
milli
- the milliseconds in which to timeout, or 0 for infinite
wait (the default).Copyright © 2002-2015 JWebUnit. All Rights Reserved.