public interface ITestingEngine
Modifier and Type | Method and Description |
---|---|
void |
beginAt(URL aInitialURL,
TestContext aTestContext)
Open the browser at an initial URL.
|
void |
checkCheckbox(String checkBoxName)
Select a specified checkbox.
|
void |
checkCheckbox(String checkBoxName,
String checkBoxValue)
Select a specified checkbox.
|
void |
clickButton(String buttonId)
Click the indicated button.
|
void |
clickButtonWithText(String buttonValueText)
Clicks a button with
text of the value attribute. |
void |
clickElementByXPath(String xpath)
Click element with given xpath.
|
void |
clickLink(String anID)
Navigate by submitting a request based on a link with a given ID.
|
void |
clickLinkWithExactText(String linkText,
int index)
Navigate by clicking a link with the exact specified text.
|
void |
clickLinkWithImage(String imageFileName,
int index)
Navigate by submitting a request based on a link with a given image file name.
|
void |
clickLinkWithText(String linkText,
int index)
Navigate by submitting a request based on a link containing the specified text.
|
void |
clickRadioOption(String radioGroup,
String radioOptionValue)
Clicks a radio option.
|
void |
closeBrowser()
Close the browser and check if there is no pending Javascript alert, confirm or prompt.
|
void |
closeWindow()
Close the current window.
|
Map<String,String> |
getAllHeaders()
Deprecated.
|
List<String> |
getComments()
Get all the comments in a document, as a list of strings.
|
List<?> |
getCookies()
Get all cookies.
|
String |
getElementAttributByXPath(String xpath,
String attribut)
Get attribut value of the given element.
|
IElement |
getElementByID(String id)
Get an element wrapper for a given ID.
|
IElement |
getElementByXPath(String xpath)
Get an element wrapper for a given xpath.
|
List<IElement> |
getElementsByXPath(String xpath)
Get a list of all elements that match the given xpath.
|
String |
getElementTextByXPath(String xpath)
Get text of the given element.
|
String |
getHeader(String name)
Get a particular header or null.
|
String |
getHiddenFieldValue(String paramName)
Return the current value of a hidden input element with name
paramName . |
InputStream |
getInputStream()
Gets the last server response as input stream.
|
InputStream |
getInputStream(URL url)
Gets the input stream for a given URL - can be used to test images or other resources without changing the current
navigation context.
|
String |
getPageSource()
Return the source of the current page (like in a browser).
|
String |
getPageText()
Return the string representation of the current page, encoded as specified by the current
TestContext . |
String |
getPageTitle()
Return the page title of the current response page, encoded as specified by the current
TestContext . |
URL |
getPageURL()
Get the location of the current page.
|
List<HttpHeader> |
getResponseHeaders()
Get all response headers.
|
String[] |
getSelectedOptions(String selectName)
Return the values of the currently selected items in a select box.
|
String[] |
getSelectedOptions(String selectName,
int index)
Return the values of the currently selected items in the Nth select box
with the provided name.
|
String |
getSelectedRadio(String radioGroup)
Return the currently selected radio button.
|
String |
getSelectOptionLabelForValue(String selectName,
int index,
String optionValue)
Get the label for a given option of the Nth select box with the
specified name.
|
String |
getSelectOptionLabelForValue(String selectName,
String optionValue)
Get the label for a given option of a select box.
|
String |
getSelectOptionValueForLabel(String selectName,
int index,
String optionLabel)
Get the value for a given option of the Nth select box with
the specified name.
|
String |
getSelectOptionValueForLabel(String selectName,
String optionLabel)
Get the value for a given option of a select box.
|
String[] |
getSelectOptionValues(String selectName)
Return a string array of select box option values.
|
String[] |
getSelectOptionValues(String selectName,
int index)
Return a string array of option values for the Nth select box
with the specified name.
|
String |
getServerResponse()
Return the response of the server for the current page.
|
int |
getServerResponseCode()
Get the request response code.
|
Table |
getTable(String tableSummaryNameOrId)
Each framework have it's own way to represent a Table.
|
String |
getTextFieldValue(String paramName)
Return the current value of a text field with name
paramName . |
int |
getWindowCount()
Get the number of opened Windows.
|
void |
gotoFrame(String frameNameOrId)
Make the frame with the given name or ID active in the current conversation.
|
void |
gotoPage(URL url)
Simulate user typing a new URL in the browser.
|
void |
gotoRootWindow()
Make the root window active.
|
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. |
void |
gotoWindow(String windowName)
Make the window with the given name active.
|
void |
gotoWindowByTitle(String title)
Goto first window with the given title.
|
boolean |
hasButton(String buttonId)
Checks if a button with
id is present. |
boolean |
hasButtonWithText(String text)
Checks if a button with
text is present. |
boolean |
hasElement(String anID)
Test if element with given id exists.
|
boolean |
hasElementByXPath(String xpath)
Test if element with given xpath exists.
|
boolean |
hasForm()
Check whether the current page contains a form.
|
boolean |
hasForm(String nameOrID)
Return true if the current page contains a specific form.
|
boolean |
hasForm(String nameOrID,
int index)
Return true if the current page contains a specific form.
|
boolean |
hasFormParameterNamed(String paramName)
Return true if a form input element is present on the current form.
|
boolean |
hasFrame(String frameNameOrId)
Test if the given frame is present.
|
boolean |
hasLink(String anId)
Return true if a link is present in the current response with the specified id.
|
boolean |
hasLinkWithExactText(String linkText,
int index)
Return true if a link is present in the current page containing the exact specified text.
|
boolean |
hasLinkWithImage(String imageFileName,
int index)
Return true if a link is present with a given image based on filename of image.
|
boolean |
hasLinkWithText(String linkText,
int index)
Return true if a link is present in the current response containing the specified text.
|
boolean |
hasRadioOption(String radioGroup,
String radioOptionValue)
Checks if a radio group contains the indicated option.
|
boolean |
hasResetButton()
Checks if the current form contains a reset button.
|
boolean |
hasResetButton(String nameOrID)
Checks if the current form contains a specific reset button.
|
boolean |
hasSelectOption(String selectName,
int index,
String optionLabel)
Test if the Nth select box has the given option (by label).
|
boolean |
hasSelectOption(String selectName,
String optionLabel)
Test if a select box has the given option (by label).
|
boolean |
hasSelectOptionValue(String selectName,
int index,
String optionValue)
Test if the Nth select box has the given option (by value).
|
boolean |
hasSelectOptionValue(String selectName,
String optionValue)
Test if a select box has the given option (by value).
|
boolean |
hasSubmitButton()
Checks if the current form contains a submit button.
|
boolean |
hasSubmitButton(String nameOrID)
Checks if the current form contains a specific submit button.
|
boolean |
hasSubmitButton(String nameOrID,
String value)
Checks if the current form contains a specific submit button.
|
boolean |
hasTable(String tableSummaryNameOrId)
Check if the Table object representing a specified table exists.
|
boolean |
hasWindow(String windowName)
Test if the window with the given name is present.
|
boolean |
hasWindowByTitle(String windowTitle)
Test if window with the given title is present.
|
boolean |
isCheckboxSelected(String checkBoxName)
Determines if the checkbox is selected.
|
boolean |
isCheckboxSelected(String checkBoxName,
String checkBoxValue)
Determines if the checkbox is selected.
|
boolean |
isMatchInElement(String elementID,
String regexp)
Return true if a given regexp is contained within the specified element.
|
boolean |
isTextInElement(String elementID,
String text)
Return true if a given string is contained within the specified element.
|
void |
reset()
Reset the current form with the default reset button.
|
void |
selectOptions(String selectName,
int index,
String[] optionValues)
Select option(s) of the Nth select box by value.
|
void |
selectOptions(String selectName,
String[] optionValues)
Select option(s) of a select box by value.
|
void |
setExpectedJavaScriptAlert(JavascriptAlert[] alerts)
Tell the testing engine that the given alert boxes are expected in the given order.
|
void |
setExpectedJavaScriptConfirm(JavascriptConfirm[] confirms)
Tell the testing engine that the given confirm boxes are expected in the given order.
|
void |
setExpectedJavaScriptPrompt(JavascriptPrompt[] prompts)
Tell the testing engine that the given prompt boxes are expected in the given order.
|
void |
setHiddenField(String inputName,
String text)
Fill hidden field with the provided text.
|
void |
setIgnoreFailingStatusCodes(boolean ignore)
Should the tester ignore failing status codes (300+)?
|
void |
setScriptingEnabled(boolean value)
Enable or disable Javascript support.
|
void |
setTextField(String inputName,
String text)
Fill a text, password or textarea field with the provided text.
|
void |
setThrowExceptionOnScriptError(boolean value)
Set whether or not to throw an exception on Javascript errors.
|
void |
setTimeout(int milliseconds)
Set the timeout for the request.
|
void |
setWorkingForm(int index)
Set the form on the current page that the client wishes to work with explicitly by index in the page.
|
void |
setWorkingForm(String nameOrId,
int index)
Set the form on the current page that the client wishes to work with explicitly by either the form name or id
(match by id is attempted first).
|
void |
submit()
Submit the current form with the default submit button.
|
void |
submit(String buttonName)
Submit the current form with the specifed submit button.
|
void |
submit(String buttonName,
String buttonValue)
Submit the current form with the specifed submit button (by name and value).
|
void |
uncheckCheckbox(String checkBoxName)
Deselect a specified checkbox.
|
void |
uncheckCheckbox(String checkBoxName,
String value)
Deselect a specified checkbox.
|
void |
unselectOptions(String selectName,
int index,
String[] optionValues)
Unselect option(s) of the Nth select box with the specified name
by value.
|
void |
unselectOptions(String selectName,
String[] optionValues)
Unselect option(s) of a select box by value.
|
void beginAt(URL aInitialURL, TestContext aTestContext) throws TestingEngineResponseException
aInitialURL
- Initial URLaTestContext
- Test contextTestingEngineResponseException
- If something bad happend (404)void closeBrowser() throws ExpectedJavascriptAlertException, ExpectedJavascriptConfirmException, ExpectedJavascriptPromptException
ExpectedJavascriptAlertException
- If there is pending Javascript alert
setExpectedJavaScriptAlert(JavascriptAlert[])
ExpectedJavascriptConfirmException
- If there is pending Javascript confirm
setExpectedJavaScriptConfirm(JavascriptConfirm[])
ExpectedJavascriptPromptException
- If there is pending Javascript prompt
setExpectedJavaScriptPrompt(JavascriptPrompt[])
void gotoPage(URL url) throws TestingEngineResponseException
url
- Full URL of the page.TestingEngineResponseException
- If something bad happend (404)void setScriptingEnabled(boolean value)
value
- true to enable Javascript.void setThrowExceptionOnScriptError(boolean value)
value
- true to throw an exception on Javascript errors.List<?> getCookies()
boolean hasWindow(String windowName)
windowName
- Name of the window.boolean hasWindowByTitle(String windowTitle)
windowTitle
- Title of the window.void gotoWindow(String windowName)
windowName
- Name of the windowvoid gotoWindowByTitle(String title)
title
- Title of the window@Deprecated void gotoWindow(int windowID)
gotoWindow(String)
or gotoWindowByTitle(String)
instead.windowID
- Javascript ID of the windowvoid gotoRootWindow()
gotoFrame(String)
.int getWindowCount()
void closeWindow()
boolean hasFrame(String frameNameOrId)
frameNameOrId
- Name or ID of the frame. ID is checked first.void gotoFrame(String frameNameOrId)
frameNameOrId
- Name or ID of the frame. ID is checked first.void setWorkingForm(int index)
index
- The 0-based index, when more than one form with the same name is expected.void setWorkingForm(String nameOrId, int index)
nameOrId
- name or id of the form to be worked with.index
- The 0-based index, when more than one form with the same name is expected.boolean hasForm()
boolean hasForm(String nameOrID)
nameOrID
- name of id of the form to check for.boolean hasForm(String nameOrID, int index)
nameOrID
- name of id of the form to check for.index
- The 0-based index, when more than one form with the same name is expected.boolean hasFormParameterNamed(String paramName)
paramName
- name of the input element to check forString getTextFieldValue(String paramName)
paramName
. Text fields are input text, input
password and textareaparamName
- name of the text field element.String getHiddenFieldValue(String paramName)
paramName
.paramName
- name of the hidden input element.void setTextField(String inputName, String text)
inputName
- name of the text, password or textarea elementtext
- value to type in the field.void setHiddenField(String inputName, String text)
inputName
- name of the hidden elementtext
- value to set in the hidden field.String[] getSelectOptionValues(String selectName)
Should return [Component_1_a, Component_1_b, Component_3, Component_4, Component_5]selectName
- name of the select box.String[] getSelectOptionValues(String selectName, int index)
selectName
- name of the select box.index
- the 0-based index used when more than one select with
the same name is expected.String[] getSelectedOptions(String selectName)
selectName
- name of the select box.String[] getSelectedOptions(String selectName, int index)
selectName
- name of the select box.index
- the 0-based index used when more than one select with
the same name is expected.String getSelectOptionLabelForValue(String selectName, String optionValue)
selectName
- name of the select box.optionValue
- label of the option.String getSelectOptionLabelForValue(String selectName, int index, String optionValue)
selectName
- name of the select box.index
- the 0-based index used when more than one select with
the same name is expected.optionValue
- label of the option.String getSelectOptionValueForLabel(String selectName, String optionLabel)
selectName
- name of the select box.optionLabel
- label of the option.String getSelectOptionValueForLabel(String selectName, int index, String optionLabel)
selectName
- name of the select box.index
- the 0-based index used when more than one select with
the same name is expected.optionLabel
- label of the option.void selectOptions(String selectName, String[] optionValues)
selectName
- name of the select box.optionValues
- values of the options to select.void selectOptions(String selectName, int index, String[] optionValues)
selectName
- name of the select box.index
- the 0-based index of the select element when multiple
select elements are expected.optionValues
- values of the options to select.void unselectOptions(String selectName, String[] optionValues)
selectName
- name of the select box.optionValues
- vaules of the options to unselect.void unselectOptions(String selectName, int index, String[] optionValues)
selectName
- name of the select box.index
- the 0-based index of the select element when multiple
select elements are expected.optionValues
- vaules of the options to unselect.boolean hasSelectOption(String selectName, String optionLabel)
selectName
- name of the select box.optionLabel
- label of the option.boolean hasSelectOptionValue(String selectName, String optionValue)
selectName
- name of the select box.optionValue
- value of the option.boolean hasSelectOption(String selectName, int index, String optionLabel)
selectName
- name of the select box.index
- the 0-based index of the select element when multiple
select elements are expected.optionLabel
- label of the option.boolean hasSelectOptionValue(String selectName, int index, String optionValue)
selectName
- name of the select box.index
- the 0-based index of the select element when multiple
select elements are expected.optionValue
- value of the option.boolean isCheckboxSelected(String checkBoxName)
checkBoxName
- name of the checkbox.boolean isCheckboxSelected(String checkBoxName, String checkBoxValue)
checkBoxName
- name attribut of the checkbox.checkBoxValue
- value attribut of the checkbox.void checkCheckbox(String checkBoxName)
checkBoxName
- name of checkbox to be selected.void checkCheckbox(String checkBoxName, String checkBoxValue)
checkBoxName
- name of checkbox to be selected.checkBoxValue
- value of the checkbox (to differenciate checkboxes with the same name).void uncheckCheckbox(String checkBoxName)
checkBoxName
- name of checkbox to be deselected.void uncheckCheckbox(String checkBoxName, String value)
checkBoxName
- name of checkbox to be deselected.value
- value of the checkbox (to differenciate checkboxes with the same name).void clickRadioOption(String radioGroup, String radioOptionValue)
radioGroup
- name of the radio group.radioOptionValue
- value of the option to check for.boolean hasRadioOption(String radioGroup, String radioOptionValue)
radioGroup
- name of the radio group.radioOptionValue
- value of the option to check for.String getSelectedRadio(String radioGroup)
radioGroup
- name of the radio group.boolean hasSubmitButton()
boolean hasSubmitButton(String nameOrID)
nameOrID
- name or id of the button to check for.boolean hasSubmitButton(String nameOrID, String value)
nameOrID
- name of id of the button to check for.value
- value of the buttonvoid submit()
#getForm
for an explanation of how the
current form is established.void submit(String buttonName)
#getForm
for an explanation of how the
current form is established.buttonName
- name of the button to use for submission.void submit(String buttonName, String buttonValue)
#getForm
for an
explanation of how the current form is established.buttonName
- name of the button to use for submission.buttonValue
- value/label of the button to use for submissionboolean hasResetButton()
boolean hasResetButton(String nameOrID)
nameOrID
- name or id of the button to check for.void reset()
#getForm
for an explanation of how the current
form is established.boolean hasButtonWithText(String text)
text
is present.text
- the text of the button (contents of the value attribute).true
when the button with text could be found.boolean hasButton(String buttonId)
id
is present.buttonId
- the ID of the button.true
when the button with text could be found.void clickButton(String buttonId)
buttonId
- the ID of the button.void clickButtonWithText(String buttonValueText)
text
of the value attribute. buttonValueText
- the text of the button (contents of the value attribute).URL getPageURL()
String getPageText()
TestContext
.String getPageSource()
String getPageTitle()
TestContext
.String getServerResponse()
InputStream getInputStream()
InputStream getInputStream(URL url) throws TestingEngineResponseException
url
- the url to the resourceTestingEngineResponseException
boolean hasTable(String tableSummaryNameOrId)
tableSummaryNameOrId
- summary, name or id of the table.Table getTable(String tableSummaryNameOrId)
tableSummaryNameOrId
- summary, name or id of the table to return.boolean hasLinkWithText(String linkText, int index)
linkText
- text to check for in links on the response.index
- The 0-based index, when more than one link with the same text is expected.boolean hasLinkWithExactText(String linkText, int index)
linkText
- text to check for in links on the response.index
- The 0-based index, when more than one link with the same text is expected.boolean hasLinkWithImage(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 text
is expected.boolean hasLink(String anId)
anId
- link id to check for.void clickLinkWithText(String linkText, int index)
linkText
- text which link to be navigated should contain.index
- The 0-based index, when more than one link with the same text is expected.void clickLinkWithExactText(String linkText, int index)
linkText
- exact text which link to be navigated should contain.index
- The 0-based index, when more than one link with the same text is expected.void clickLink(String anID)
anID
- id of link to be navigated.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 text is expected.boolean hasElement(String anID)
anID
- id of the element.boolean hasElementByXPath(String xpath)
xpath
- xpath of the element.void clickElementByXPath(String xpath)
xpath
- xpath of the element.String getElementAttributByXPath(String xpath, String attribut)
xpath
- xpath of the element.attribut
- name of the attribut.String getElementTextByXPath(String xpath)
xpath
- xpath of the element.boolean isTextInElement(String elementID, String text)
elementID
- ID of element to inspect.text
- text to check for.boolean isMatchInElement(String elementID, String regexp)
elementID
- Id of element to inspect.regexp
- regexp to match.void setExpectedJavaScriptAlert(JavascriptAlert[] alerts) throws ExpectedJavascriptAlertException
alerts
- Expected alerts.ExpectedJavascriptAlertException
- If there are still unconsummed alert since a previous call of this
method.void setExpectedJavaScriptConfirm(JavascriptConfirm[] confirms) throws ExpectedJavascriptConfirmException
confirms
- Expected confirms.ExpectedJavascriptConfirmException
- If there are still unconsummed confirm since a previous call of this
method.void setExpectedJavaScriptPrompt(JavascriptPrompt[] prompts) throws ExpectedJavascriptPromptException
prompts
- Expected prompts.ExpectedJavascriptPromptException
- If there are still unconsummed prompt since a previous call of this
method.IElement getElementByXPath(String xpath)
xpath
- XPath to evaluategetElementsByXPath(String)
IElement getElementByID(String id)
id
- element ID to findList<IElement> getElementsByXPath(String xpath)
xpath
- XPath to evaluategetElementByXPath(String)
int getServerResponseCode()
String getHeader(String name)
name
- The header name@Deprecated Map<String,String> getAllHeaders()
getResponseHeaders()
List<HttpHeader> getResponseHeaders()
HttpHeader
svoid setIgnoreFailingStatusCodes(boolean ignore)
ignore
- void setTimeout(int milliseconds)
milliseconds
- the milliseconds in which to timeout, or 0 for infinite
wait (the default).Copyright © 2002-2015 JWebUnit. All Rights Reserved.