public class HtmlUnitTestingEngineImpl extends Object implements ITestingEngine
| Constructor and Description |
|---|
HtmlUnitTestingEngineImpl()
Initializes default HtmlUnit testing engine implementation.
|
| Modifier and Type | Method and Description |
|---|---|
void |
beginAt(URL initialURL,
TestContext context)
Begin a dialog with an initial URL and test client context.
|
void |
checkCheckbox(String checkBoxName)
Select a specified checkbox.
|
void |
checkCheckbox(String checkBoxName,
String value)
Select a specified checkbox.
|
void |
clickButton(String buttonId)
Click the indicated button (input type=button).
|
void |
clickButtonWithText(String buttonValueText)
Clicks the first button that contains the specified text as its label.
|
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 radioOption)
Clicks a radio option.
|
void |
closeBrowser()
Close the browser and check that all expected Javascript alerts, confirms and
prompts have been taken care of.
|
void |
closeWindow()
Close the current window.
|
protected com.gargoylesoftware.htmlunit.WebClient |
createWebClient()
Create the
WebClient that will be used for this test. |
Map<String,String> |
getAllHeaders()
Deprecated.
|
com.gargoylesoftware.htmlunit.html.HtmlElement |
getButtonWithText(String buttonValueText)
Returns the first button that contains the specified text as its label.
|
List<String> |
getComments()
Get all the comments in a document, as a list of strings.
|
List<javax.servlet.http.Cookie> |
getCookies()
Get all cookies.
|
protected com.gargoylesoftware.htmlunit.html.HtmlPage |
getCurrentPage() |
String |
getCurrentPageTitle()
Return the page title of the current response page, encoded as specified by the current
TestContext. |
com.gargoylesoftware.htmlunit.WebWindow |
getCurrentWindow()
Return the currently opened window (issue 2697234).
|
com.gargoylesoftware.htmlunit.BrowserVersion |
getDefaultBrowserVersion()
An alternative to setting the
user agent string manually
is to provide it with all the information for a complete browser version. |
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.
|
protected com.gargoylesoftware.htmlunit.html.HtmlForm |
getForm()
Return the current form active for the dialog.
|
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 resourceUrl)
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.
|
com.gargoylesoftware.htmlunit.html.HtmlElement |
getResetButton(String buttonName) |
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 value)
Get the label for a given option of the Nth select box with the
specified name.
|
String |
getSelectOptionLabelForValue(String selectName,
String value)
Get the label for a given option of a select box.
|
String |
getSelectOptionValueForLabel(String selectName,
int index,
String label)
Get the value for a given option of the Nth select box with
the specified name.
|
String |
getSelectOptionValueForLabel(String selectName,
String label)
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 the Nth select box option values.
|
String |
getServerResponse()
Return the response of the server for the current page.
|
int |
getServerResponseCode()
Get the request response code.
|
com.gargoylesoftware.htmlunit.html.HtmlElement |
getSubmitButton(String buttonName)
Return the HtmlUnit submit button with a given name.
|
com.gargoylesoftware.htmlunit.html.HtmlElement |
getSubmitButton(String buttonName,
String buttonValue)
Return the HtmlUnit submit button with a given name and value.
|
Table |
getTable(String tableSummaryNameOrId)
Each framework have it's own way to represent a Table.
|
protected TestContext |
getTestContext() |
String |
getTextFieldValue(String paramName)
Return the current value of a text input element with name
paramName. |
com.gargoylesoftware.htmlunit.WebClient |
getWebClient()
Return the current web client (issue 2697234).
|
com.gargoylesoftware.htmlunit.WebResponse |
getWebResponse()
Get the last WebResponse from HtmlUnit.
|
com.gargoylesoftware.htmlunit.WebWindow |
getWindow(String windowName)
Return the window with the given name in the current conversation.
|
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 initialURL)
Go to a particular page.
|
void |
gotoRootWindow()
Make the root window active.
|
void |
gotoWindow(int windowID)
Goto window with the given Javascript ID.
|
void |
gotoWindow(String windowName)
Make the window with the given name in the current conversation active.
|
void |
gotoWindowByTitle(String title)
Goto first window with the given title.
|
boolean |
hasButton(String buttonId)
Returns if the button identified by
buttonId is present. |
boolean |
hasButtonWithText(String text)
Checks whether a button containing the specified text as its label exists.
|
boolean |
hasElement(String anID)
Test if element with given id exists.
|
boolean |
hasElementByXPath(String xpath)
Test if element with given xpath exists.
|
boolean |
hasForm()
Return true if the current response contains a form.
|
boolean |
hasForm(String nameOrID)
Return true if the current response 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 |
hasFormSelectNamed(String selectName)
Return true if a form parameter (input element) is present on the current response.
|
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 (note that HttpUnit uses
contains rather than an exact match - if this is a problem consider using ids on the links to uniquely identify
them).
|
boolean |
hasRadioOption(String radioGroup,
String radioOption)
Return true if a radio group contains the indicated option.
|
boolean |
hasResetButton()
Checks if the current form contains a reset button.
A reset button can be the following HTML elements: input type=reset button type=reset |
boolean |
hasResetButton(String buttonName)
Checks if the current form contains a specific reset button.
A reset button can be the following HTML elements: input type=reset button type=reset |
boolean |
hasSelectOption(String selectName,
int index,
String optionLabel)
Return true if the Nth select box contains the indicated option.
|
boolean |
hasSelectOption(String selectName,
String optionLabel)
Return true if a select box contains the indicated option.
|
boolean |
hasSelectOptionValue(String selectName,
int index,
String optionValue)
Return true if the Nth select box contains the indicated option.
|
boolean |
hasSelectOptionValue(String selectName,
String optionValue)
Return true if a select box contains the indicated option.
|
boolean |
hasSubmitButton()
Checks if the current form contains a submit button.
|
boolean |
hasSubmitButton(String buttonName)
Checks if the current form contains a specific submit button.
A submit button can be the following HTML elements: input type=submit input type=image button type=submit |
boolean |
hasSubmitButton(String buttonName,
String buttonValue)
Checks if the current form contains a specific submit button.
A submit button can be the following HTML elements: input type=submit input type=image button type=submit |
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 title)
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.
|
boolean |
isTextInTable(String tableSummaryOrId,
String text)
Return true if given text is present in a specified table of the response.
|
void |
reset()
Reset the current form.
|
void |
selectOptions(String selectName,
int index,
String[] options)
Select the specified set of options in the select element
with the provided name.
|
void |
selectOptions(String selectName,
String[] options)
Select the specified set of options in the select element
with the provided name.
|
void |
setDefaultBrowserVersion(com.gargoylesoftware.htmlunit.BrowserVersion defaultBrowserVersion)
An alternative to setting the
user agent string manually
is to provide it with all the information for a complete browser version. |
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 fieldName,
String text)
Set a form hidden element to the provided value.
|
void |
setIgnoreFailingStatusCodes(boolean ignore)
Should the tester ignore failing status codes (300+)? Otherwise,
failing status codes will throw an exception.
|
void |
setRefreshHandler(com.gargoylesoftware.htmlunit.RefreshHandler handler) |
void |
setScriptingEnabled(boolean value)
Enable or disable Javascript support.
|
void |
setTextField(String paramName,
String text)
Set a form text, password input element or textarea to the provided value.
|
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 specified 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[] options)
Unselect option(s) of the Nth select box with the specified name
by value.
|
void |
unselectOptions(String selectName,
String[] options)
Unselect option(s) of a select box by value.
|
public HtmlUnitTestingEngineImpl()
public void beginAt(URL initialURL, TestContext context) throws TestingEngineResponseException
beginAt in interface ITestingEngineinitialURL - absolute url at which to begin dialog.context - contains context information for the test client.TestingEngineResponseExceptionpublic void closeBrowser()
throws ExpectedJavascriptAlertException,
ExpectedJavascriptConfirmException,
ExpectedJavascriptPromptException
closeBrowser in interface ITestingEngineExpectedJavascriptAlertException - If there is pending Javascript alert
ITestingEngine.setExpectedJavaScriptAlert(JavascriptAlert[])ExpectedJavascriptConfirmException - If there is pending Javascript confirm
ITestingEngine.setExpectedJavaScriptConfirm(JavascriptConfirm[])ExpectedJavascriptPromptException - If there is pending Javascript prompt
ITestingEngine.setExpectedJavaScriptPrompt(JavascriptPrompt[])public void gotoPage(URL initialURL) throws TestingEngineResponseException
gotoPage in interface ITestingEngineinitialURL - Full URL of the page.TestingEngineResponseException - if an error response code is encountered
and ignoreFailingStatusCodes is not enabled.public void setScriptingEnabled(boolean value)
ITestingEnginesetScriptingEnabled in interface ITestingEnginevalue - true to enable Javascript.net.sourceforge.jwebunit.api.IJWebUnitDialog#setScriptingEnabled(boolean)public void setThrowExceptionOnScriptError(boolean value)
ITestingEnginesetThrowExceptionOnScriptError in interface ITestingEnginevalue - true to throw an exception on Javascript errors.public List<javax.servlet.http.Cookie> getCookies()
ITestingEnginegetCookies in interface ITestingEnginepublic boolean hasWindow(String windowName)
ITestingEnginehasWindow in interface ITestingEnginewindowName - Name of the window.public boolean hasWindowByTitle(String title)
ITestingEnginehasWindowByTitle in interface ITestingEnginetitle - Title of the window.public void gotoWindow(String windowName)
gotoWindow in interface ITestingEnginewindowName - public void gotoWindow(int windowID)
ITestingEnginegotoWindow in interface ITestingEnginewindowID - Javascript ID of the windowpublic int getWindowCount()
ITestingEnginegetWindowCount in interface ITestingEnginepublic void gotoWindowByTitle(String title)
gotoWindowByTitle in interface ITestingEnginetitle - public void closeWindow()
closeWindow in interface ITestingEnginepublic boolean hasFrame(String frameNameOrId)
hasFrame in interface ITestingEngineframeNameOrId - Name or ID of the frame. ID is checked first.public void gotoFrame(String frameNameOrId)
gotoFrame in interface ITestingEngineframeNameOrId - Name or ID of the frame. ID is checked first.public void setWorkingForm(int index)
setWorkingForm in interface ITestingEngineindex - The 0-based index, when more than one form with the same name is expected.public void setWorkingForm(String nameOrId, int index)
setWorkingForm in interface ITestingEnginenameOrId - 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.public boolean hasForm()
hasForm in interface ITestingEnginepublic boolean hasForm(String nameOrID)
hasForm in interface ITestingEnginenameOrID - name of id of the form to check for.public boolean hasForm(String nameOrID, int index)
ITestingEnginehasForm in interface ITestingEnginenameOrID - 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.public boolean hasFormParameterNamed(String paramName)
ITestingEnginehasFormParameterNamed in interface ITestingEngineparamName - name of the input element to check forpublic String getTextFieldValue(String paramName)
paramName.getTextFieldValue in interface ITestingEngineparamName - name of the input element. TODO: Find a way to handle multiple text input element with same
name.public String getHiddenFieldValue(String paramName)
paramName.getHiddenFieldValue in interface ITestingEngineparamName - name of the input element. TODO: Find a way to handle multiple hidden input element with same
name.public void setTextField(String paramName, String text)
setTextField in interface ITestingEnginefieldName - name of the input element or textareatext - parameter value to submit for the element.public void setHiddenField(String fieldName, String text)
setHiddenField in interface ITestingEnginefieldName - name of the hidden input elementparamValue - parameter value to submit for the element.public String[] getSelectOptionValues(String selectName)
getSelectOptionValues in interface ITestingEngineselectName - name of the select box.public String[] getSelectOptionValues(String selectName, int index)
getSelectOptionValues in interface ITestingEngineselectName - name of the select box.index - the 0-based index when more than one
select with the same name is expected.public String[] getSelectedOptions(String selectName)
ITestingEnginegetSelectedOptions in interface ITestingEngineselectName - name of the select box.public String[] getSelectedOptions(String selectName, int index)
ITestingEnginegetSelectedOptions in interface ITestingEngineselectName - name of the select box.index - the 0-based index used when more than one select with
the same name is expected.public String getSelectOptionValueForLabel(String selectName, String label)
ITestingEnginegetSelectOptionValueForLabel in interface ITestingEngineselectName - name of the select box.label - label of the option.public String getSelectOptionValueForLabel(String selectName, int index, String label)
ITestingEnginegetSelectOptionValueForLabel in interface ITestingEngineselectName - name of the select box.index - the 0-based index used when more than one select with
the same name is expected.label - label of the option.public String getSelectOptionLabelForValue(String selectName, String value)
ITestingEnginegetSelectOptionLabelForValue in interface ITestingEngineselectName - name of the select box.value - label of the option.public String getSelectOptionLabelForValue(String selectName, int index, String value)
ITestingEnginegetSelectOptionLabelForValue in interface ITestingEngineselectName - name of the select box.index - the 0-based index used when more than one select with
the same name is expected.value - label of the option.public URL getPageURL()
ITestingEnginegetPageURL in interface ITestingEnginepublic String getPageSource()
ITestingEnginegetPageSource in interface ITestingEnginepublic String getPageTitle()
ITestingEngineTestContext.getPageTitle in interface ITestingEnginepublic String getPageText()
ITestingEngineTestContext.getPageText in interface ITestingEnginepublic String getServerResponse()
ITestingEnginegetServerResponse in interface ITestingEnginepublic InputStream getInputStream()
ITestingEnginegetInputStream in interface ITestingEnginepublic InputStream getInputStream(URL resourceUrl) throws TestingEngineResponseException
ITestingEnginegetInputStream in interface ITestingEngineresourceUrl - the url to the resourceTestingEngineResponseExceptionprotected com.gargoylesoftware.htmlunit.WebClient createWebClient()
WebClient that will be used for this test.
Subclasses should only override this method if they need to override
the default WebClient.
Also see issue 2697234.
WebClientpublic com.gargoylesoftware.htmlunit.WebWindow getWindow(String windowName)
windowName - com.gargoylesoftware.htmlunit.WebWindowNotFoundException - if the window could not be foundpublic com.gargoylesoftware.htmlunit.WebWindow getCurrentWindow()
public com.gargoylesoftware.htmlunit.WebClient getWebClient()
public List<String> getComments()
getComments in interface ITestingEnginepublic String getCurrentPageTitle()
TestContext.protected com.gargoylesoftware.htmlunit.html.HtmlForm getForm()
Return the current form active for the dialog.
The active form can also be explicitly set by setWorkingForm(int).
If this method is called without the form having been implicitly or explicitly set, it will attempt to return the default first form on the page.
UnableToSetFormException - This runtime assertion failure will be raised if there is no form on the
response.protected com.gargoylesoftware.htmlunit.html.HtmlPage getCurrentPage()
public boolean hasFormSelectNamed(String selectName)
selectName - name of the input element to check forpublic com.gargoylesoftware.htmlunit.html.HtmlElement getSubmitButton(String buttonName)
buttonName - name of button.public com.gargoylesoftware.htmlunit.html.HtmlElement getResetButton(String buttonName)
public com.gargoylesoftware.htmlunit.html.HtmlElement getSubmitButton(String buttonName, String buttonValue)
buttonName - button name.buttonValue - button value.public boolean hasSubmitButton()
hasSubmitButton in interface ITestingEnginepublic boolean hasSubmitButton(String buttonName)
hasSubmitButton in interface ITestingEnginebuttonName - name or id of the button to check for.public boolean hasSubmitButton(String buttonName, String buttonValue)
hasSubmitButton in interface ITestingEnginebuttonName - name of id of the button to check for.buttonValue - value of the buttonpublic boolean hasResetButton()
ITestingEnginehasResetButton in interface ITestingEnginepublic boolean hasResetButton(String buttonName)
ITestingEnginehasResetButton in interface ITestingEnginebuttonName - name or id of the button to check for.public boolean hasButtonWithText(String text)
This method does not check whether the button is currently visible to the client.
hasButtonWithText in interface ITestingEnginetext - the text of the button (between <button></button>)
or the value of the "value" attribute.true when the button with text could be found.public com.gargoylesoftware.htmlunit.html.HtmlElement getButtonWithText(String buttonValueText)
This method does not check whether the button is currently visible to the client.
buttonValueText - the text of the button (between <button></button>)
or the value of the "value" attribute.public boolean hasButton(String buttonId)
buttonId is present.hasButton in interface ITestingEnginebuttonId - the id of the buttontrue when the button was found.public boolean isCheckboxSelected(String checkBoxName)
ITestingEngineisCheckboxSelected in interface ITestingEnginecheckBoxName - name of the checkbox.public boolean isCheckboxSelected(String checkBoxName, String checkBoxValue)
ITestingEngineisCheckboxSelected in interface ITestingEnginecheckBoxName - name attribut of the checkbox.checkBoxValue - value attribut of the checkbox.public boolean isTextInTable(String tableSummaryOrId, String text)
tableSummaryOrId - table summary or id to inspect for expected text.text - expected text to check for.public Table getTable(String tableSummaryNameOrId)
ITestingEnginegetTable in interface ITestingEnginetableSummaryNameOrId - summary, name or id of the table to return.public boolean hasTable(String tableSummaryNameOrId)
ITestingEnginehasTable in interface ITestingEnginetableSummaryNameOrId - summary, name or id of the table.public void submit()
getForm()for an explanation of how the
current form is established.submit in interface ITestingEnginepublic void submit(String buttonName)
getForm()for an explanation of how the
current form is established.submit in interface ITestingEnginebuttonName - name of the button to use for submission.public void submit(String buttonName, String buttonValue)
getForm()for an
explanation of how the current form is established.submit in interface ITestingEnginebuttonName - name of the button to use for submission.buttonValue - value/label of the button to use for submissionpublic void reset()
getForm()for an explanation of how the current form is established.reset in interface ITestingEnginepublic boolean hasLinkWithText(String linkText, int index)
hasLinkWithText in interface ITestingEnginelinkText - 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.public boolean hasLinkWithExactText(String linkText, int index)
ITestingEnginehasLinkWithExactText in interface ITestingEnginelinkText - 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.public boolean hasLinkWithImage(String imageFileName, int index)
ITestingEnginehasLinkWithImage in interface ITestingEngineimageFileName - 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.public boolean hasLink(String anId)
hasLink in interface ITestingEngineanId - link id to check for.public void clickLinkWithText(String linkText, int index)
ITestingEngineclickLinkWithText in interface ITestingEnginelinkText - text which link to be navigated should contain.index - The 0-based index, when more than one link with the same text is expected.public void clickLinkWithExactText(String linkText, int index)
ITestingEngineclickLinkWithExactText in interface ITestingEnginelinkText - 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.public void checkCheckbox(String checkBoxName)
checkCheckbox in interface ITestingEnginecheckBoxName - name of checkbox to be deselected.public void checkCheckbox(String checkBoxName, String value)
ITestingEnginecheckCheckbox in interface ITestingEnginecheckBoxName - name of checkbox to be selected.value - value of the checkbox (to differenciate checkboxes with the same name).public void uncheckCheckbox(String checkBoxName)
uncheckCheckbox in interface ITestingEnginecheckBoxName - name of checkbox to be deselected.public void uncheckCheckbox(String checkBoxName, String value)
ITestingEngineuncheckCheckbox in interface ITestingEnginecheckBoxName - name of checkbox to be deselected.value - value of the checkbox (to differenciate checkboxes with the same name).public void clickRadioOption(String radioGroup, String radioOption)
clickRadioOption in interface ITestingEngineradioGroup - name of the radio group.radioOption - value of the option to check for.public void clickLink(String anID)
clickLink in interface ITestingEngineanID - id of link to be navigated.public void clickLinkWithImage(String imageFileName, int index)
clickLinkWithImage in interface ITestingEngineimageFileName - 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.public boolean hasElement(String anID)
ITestingEnginehasElement in interface ITestingEngineanID - id of the element.public boolean hasElementByXPath(String xpath)
ITestingEnginehasElementByXPath in interface ITestingEnginexpath - xpath of the element.public void clickElementByXPath(String xpath)
ITestingEngineclickElementByXPath in interface ITestingEnginexpath - xpath of the element.public String getElementAttributByXPath(String xpath, String attribut)
ITestingEnginegetElementAttributByXPath in interface ITestingEnginexpath - xpath of the element.attribut - name of the attribut.public String getElementTextByXPath(String xpath)
ITestingEnginegetElementTextByXPath in interface ITestingEnginexpath - xpath of the element.public void clickButton(String buttonId)
clickButton in interface ITestingEnginebuttonId - public void clickButtonWithText(String buttonValueText)
clickButtonWithText in interface ITestingEnginebuttonValueText - the text of the button (contents of the value attribute).public boolean hasRadioOption(String radioGroup, String radioOption)
hasRadioOption in interface ITestingEngineradioGroup - name of the radio group.radioOption - value of the option to check for.public String getSelectedRadio(String radioGroup)
ITestingEnginegetSelectedRadio in interface ITestingEngineradioGroup - name of the radio group.public boolean hasSelectOption(String selectName, String optionLabel)
hasSelectOption in interface ITestingEngineselectName - name of the select box.optionLabel - label of the option.public boolean hasSelectOptionValue(String selectName, String optionValue)
hasSelectOptionValue in interface ITestingEngineselectName - name of the select box.optionValue - value of the option.public void selectOptions(String selectName, String[] options)
selectOptions in interface ITestingEngineselectName - name of the select boxoptions - set of options to select.public boolean hasSelectOption(String selectName, int index, String optionLabel)
hasSelectOption in interface ITestingEngineselectName - 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.public boolean hasSelectOptionValue(String selectName, int index, String optionValue)
hasSelectOptionValue in interface ITestingEngineselectName - 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.public void selectOptions(String selectName, int index, String[] options)
selectOptions in interface ITestingEngineselectName - name of the select boxindex - the 0-based index of the select element when multiple
select elements are expected.options - set of options to select.public void unselectOptions(String selectName, String[] options)
ITestingEngineunselectOptions in interface ITestingEngineselectName - name of the select box.options - vaules of the options to unselect.public void unselectOptions(String selectName, int index, String[] options)
ITestingEngineunselectOptions in interface ITestingEngineselectName - name of the select box.index - the 0-based index of the select element when multiple
select elements are expected.options - vaules of the options to unselect.public boolean isTextInElement(String elementID, String text)
ITestingEngineisTextInElement in interface ITestingEngineelementID - ID of element to inspect.text - text to check for.public boolean isMatchInElement(String elementID, String regexp)
ITestingEngineisMatchInElement in interface ITestingEngineelementID - Id of element to inspect.regexp - regexp to match.public void gotoRootWindow()
ITestingEngine.gotoFrame(String).gotoRootWindow in interface ITestingEngineprotected TestContext getTestContext()
public void setExpectedJavaScriptAlert(JavascriptAlert[] alerts) throws ExpectedJavascriptAlertException
ITestingEnginesetExpectedJavaScriptAlert in interface ITestingEnginealerts - Expected alerts.ExpectedJavascriptAlertException - If there are still unconsummed alert since a previous call of this
method.public void setExpectedJavaScriptConfirm(JavascriptConfirm[] confirms) throws ExpectedJavascriptConfirmException
ITestingEnginesetExpectedJavaScriptConfirm in interface ITestingEngineconfirms - Expected confirms.ExpectedJavascriptConfirmException - If there are still unconsummed confirm since a previous call of this
method.public void setExpectedJavaScriptPrompt(JavascriptPrompt[] prompts) throws ExpectedJavascriptPromptException
ITestingEnginesetExpectedJavaScriptPrompt in interface ITestingEngineprompts - Expected prompts.ExpectedJavascriptPromptException - If there are still unconsummed prompt since a previous call of this
method.public IElement getElementByXPath(String xpath)
ITestingEnginegetElementByXPath in interface ITestingEnginexpath - XPath to evaluateITestingEngine.getElementsByXPath(String)public IElement getElementByID(String id)
ITestingEnginegetElementByID in interface ITestingEngineid - element ID to findpublic List<IElement> getElementsByXPath(String xpath)
ITestingEnginegetElementsByXPath in interface ITestingEnginexpath - XPath to evaluateITestingEngine.getElementByXPath(String)public int getServerResponseCode()
ITestingEnginegetServerResponseCode in interface ITestingEnginepublic com.gargoylesoftware.htmlunit.WebResponse getWebResponse()
public void setIgnoreFailingStatusCodes(boolean ignore)
ITestingEnginesetIgnoreFailingStatusCodes in interface ITestingEnginepublic String getHeader(String name)
ITestingEnginegetHeader in interface ITestingEnginename - The header name@Deprecated public Map<String,String> getAllHeaders()
ITestingEnginegetAllHeaders in interface ITestingEnginepublic List<HttpHeader> getResponseHeaders()
ITestingEnginegetResponseHeaders in interface ITestingEngineHttpHeaderspublic com.gargoylesoftware.htmlunit.BrowserVersion getDefaultBrowserVersion()
user agent string manually
is to provide it with all the information for a complete browser version.BrowserVersionpublic void setDefaultBrowserVersion(com.gargoylesoftware.htmlunit.BrowserVersion defaultBrowserVersion)
user agent string manually
is to provide it with all the information for a complete browser version.the - browser version to set as default for this engine instanceBrowserVersionpublic void setTimeout(int milliseconds)
ITestingEnginesetTimeout in interface ITestingEnginemilliseconds - the milliseconds in which to timeout, or 0 for infinite
wait (the default).public void setRefreshHandler(com.gargoylesoftware.htmlunit.RefreshHandler handler)
Copyright © 2002–2017 JWebUnit. All rights reserved.