|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sourceforge.jwebunit.htmlunit.HtmlUnitDialog
Acts as the wrapper for HtmlUnit access. A dialog is initialized with a given URL, and maintains conversational state as the dialog progresses through link navigation, form submission, etc.
| Constructor Summary | |
HtmlUnitDialog()
|
|
| Method Summary | |
void |
beginAt(String initialURL,
net.sourceforge.jwebunit.util.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)
|
void |
clickButton(String buttonId)
Click the indicated button (input type=button). |
void |
clickButtonWithText(String buttonValueText)
|
void |
clickElementByXPath(String xpath)
|
void |
clickLink(String anID)
Navigate by submitting a request based on a link with a given ID. |
void |
clickLinkWithExactText(String linkText,
int index)
|
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)
|
void |
clickRadioOption(String radioGroup,
String radioOption)
Clicks a radio option. |
void |
closeBrowser()
|
void |
closeWindow()
|
com.gargoylesoftware.htmlunit.html.HtmlButton |
getButtonWithText(String buttonValueText)
|
List |
getCookies()
|
String |
getCurrentPageTitle()
Return the page title of the current response page, encoded as specified by the current TestContext. |
String |
getElementAttributByXPath(String xpath,
String attribut)
|
String |
getHiddenFieldValue(String paramName)
Return the current value of a hidden input element with name paramName. |
com.gargoylesoftware.htmlunit.html.HtmlTable |
getHtmlTable(String tableSummaryOrId)
Return the HttpUnit WebTable object representing a specified table in the current response. |
String |
getPageSource()
|
String |
getPageText()
|
String |
getPageTitle()
|
com.gargoylesoftware.htmlunit.html.HtmlResetInput |
getResetButton(String buttonName)
|
String[] |
getSelectedOptions(String selectName)
|
String |
getSelectOptionLabelForValue(String selectName,
String value)
|
String |
getSelectOptionValueForLabel(String selectName,
String label)
|
String[] |
getSelectOptionValues(String selectName)
Return a string array of select box option values. |
String |
getServerResponse()
|
com.gargoylesoftware.htmlunit.html.ClickableElement |
getSubmitButton(String buttonName)
Return the HtmlUnit submit button with a given name. |
com.gargoylesoftware.htmlunit.html.ClickableElement |
getSubmitButton(String buttonName,
String buttonValue)
Return the HtmlUnit submit button with a given name and value. |
net.sourceforge.jwebunit.html.Table |
getTable(String tableSummaryOrId)
|
String |
getTextFieldValue(String paramName)
Return the current value of a text input element with name paramName. |
int |
getWindowCount()
|
void |
gotoFrame(String frameNameOrId)
|
void |
gotoPage(String initialURL)
|
void |
gotoRootWindow()
Make the root window in the current conversation active. |
void |
gotoWindow(int windowID)
|
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 if a button with text is present. |
boolean |
hasElement(String anID)
|
boolean |
hasElementByXPath(String xpath)
|
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 |
hasFormInputNamed(String inputName)
Return true if a form parameter (input element) is present on the current response. |
boolean |
hasFormParameterNamed(String paramName)
|
boolean |
hasFormSelectNamed(String selectName)
Return true if a form parameter (input element) is present on the current response. |
boolean |
hasFrame(String frameNameOrId)
|
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)
|
boolean |
hasLinkWithImage(String imageFileName,
int index)
|
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()
|
boolean |
hasResetButton(String buttonName)
|
boolean |
hasSelectOption(String selectName,
String optionLabel)
Return true if a select box contains the indicated option. |
boolean |
hasSelectOptionValue(String selectName,
String optionValue)
Return true if a select box contains the indicated option. |
boolean |
hasSubmitButton()
|
boolean |
hasSubmitButton(String buttonName)
|
boolean |
hasSubmitButton(String buttonName,
String buttonValue)
|
boolean |
hasTable(String tableSummaryOrId)
|
boolean |
hasWindow(String windowName)
|
boolean |
hasWindowByTitle(String title)
|
boolean |
isCheckboxSelected(String checkBoxName)
|
boolean |
isCheckboxSelected(String checkBoxName,
String checkBoxValue)
|
boolean |
isMatchInElement(String elementID,
String regexp)
|
boolean |
isTextInElement(String elementID,
String text)
|
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 |
saveAs(File f)
|
void |
selectOptions(String selectName,
String[] options)
|
void |
setExpectedJavaScriptAlert(net.sourceforge.jwebunit.javascript.JavascriptAlert[] alerts)
|
void |
setExpectedJavaScriptConfirm(net.sourceforge.jwebunit.javascript.JavascriptConfirm[] confirms)
|
void |
setExpectedJavaScriptPrompt(net.sourceforge.jwebunit.javascript.JavascriptPrompt[] prompts)
|
void |
setScriptingEnabled(boolean value)
|
void |
setTextField(String fieldName,
String text)
Set a form text, password input element or textarea to the provided value. |
void |
setWorkingForm(int index)
|
void |
setWorkingForm(String nameOrId,
int index)
|
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)
|
void |
unselectOptions(String selectName,
String[] options)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public HtmlUnitDialog()
| Method Detail |
public void beginAt(String initialURL,
net.sourceforge.jwebunit.util.TestContext context)
throws net.sourceforge.jwebunit.exception.TestingEngineResponseException
beginAt in interface net.sourceforge.jwebunit.api.IJWebUnitDialoginitialURL - absolute url at which to begin dialog.context - contains context information for the test client.
net.sourceforge.jwebunit.exception.TestingEngineResponseException
public void closeBrowser()
throws net.sourceforge.jwebunit.exception.ExpectedJavascriptAlertException,
net.sourceforge.jwebunit.exception.ExpectedJavascriptConfirmException,
net.sourceforge.jwebunit.exception.ExpectedJavascriptPromptException
closeBrowser in interface net.sourceforge.jwebunit.api.IJWebUnitDialognet.sourceforge.jwebunit.exception.ExpectedJavascriptAlertException
net.sourceforge.jwebunit.exception.ExpectedJavascriptConfirmException
net.sourceforge.jwebunit.exception.ExpectedJavascriptPromptException
public void gotoPage(String initialURL)
throws net.sourceforge.jwebunit.exception.TestingEngineResponseException
gotoPage in interface net.sourceforge.jwebunit.api.IJWebUnitDialognet.sourceforge.jwebunit.exception.TestingEngineResponseExceptionpublic void setScriptingEnabled(boolean value)
setScriptingEnabled in interface net.sourceforge.jwebunit.api.IJWebUnitDialogIJWebUnitDialog.setScriptingEnabled(boolean)public List getCookies()
getCookies in interface net.sourceforge.jwebunit.api.IJWebUnitDialogpublic boolean hasWindow(String windowName)
hasWindow in interface net.sourceforge.jwebunit.api.IJWebUnitDialogpublic boolean hasWindowByTitle(String title)
hasWindowByTitle in interface net.sourceforge.jwebunit.api.IJWebUnitDialogpublic void gotoWindow(String windowName)
gotoWindow in interface net.sourceforge.jwebunit.api.IJWebUnitDialogwindowName - public void gotoWindow(int windowID)
gotoWindow in interface net.sourceforge.jwebunit.api.IJWebUnitDialogpublic int getWindowCount()
getWindowCount in interface net.sourceforge.jwebunit.api.IJWebUnitDialogpublic void gotoWindowByTitle(String title)
gotoWindowByTitle in interface net.sourceforge.jwebunit.api.IJWebUnitDialogpublic void closeWindow()
closeWindow in interface net.sourceforge.jwebunit.api.IJWebUnitDialogpublic boolean hasFrame(String frameNameOrId)
hasFrame in interface net.sourceforge.jwebunit.api.IJWebUnitDialogpublic void gotoFrame(String frameNameOrId)
gotoFrame in interface net.sourceforge.jwebunit.api.IJWebUnitDialogpublic void setWorkingForm(int index)
setWorkingForm in interface net.sourceforge.jwebunit.api.IJWebUnitDialog
public void setWorkingForm(String nameOrId,
int index)
setWorkingForm in interface net.sourceforge.jwebunit.api.IJWebUnitDialogpublic boolean hasForm()
hasForm in interface net.sourceforge.jwebunit.api.IJWebUnitDialogpublic boolean hasForm(String nameOrID)
hasForm in interface net.sourceforge.jwebunit.api.IJWebUnitDialognameOrID - name of id of the form to check for.public boolean hasFormParameterNamed(String paramName)
hasFormParameterNamed in interface net.sourceforge.jwebunit.api.IJWebUnitDialogpublic String getTextFieldValue(String paramName)
paramName.
getTextFieldValue in interface net.sourceforge.jwebunit.api.IJWebUnitDialogparamName - 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 net.sourceforge.jwebunit.api.IJWebUnitDialogparamName - name of the input element. TODO: Find a way to handle multiple hidden input element with same
name.
public void setTextField(String fieldName,
String text)
setTextField in interface net.sourceforge.jwebunit.api.IJWebUnitDialogfieldName - name of the input element or textareapublic String[] getSelectOptionValues(String selectName)
getSelectOptionValues in interface net.sourceforge.jwebunit.api.IJWebUnitDialogselectName - name of the select box.public String[] getSelectedOptions(String selectName)
getSelectedOptions in interface net.sourceforge.jwebunit.api.IJWebUnitDialog
public String getSelectOptionValueForLabel(String selectName,
String label)
getSelectOptionValueForLabel in interface net.sourceforge.jwebunit.api.IJWebUnitDialog
public String getSelectOptionLabelForValue(String selectName,
String value)
getSelectOptionLabelForValue in interface net.sourceforge.jwebunit.api.IJWebUnitDialogpublic String getPageSource()
getPageSource in interface net.sourceforge.jwebunit.api.IJWebUnitDialogpublic String getPageTitle()
getPageTitle in interface net.sourceforge.jwebunit.api.IJWebUnitDialogpublic String getPageText()
getPageText in interface net.sourceforge.jwebunit.api.IJWebUnitDialogpublic String getServerResponse()
getServerResponse in interface net.sourceforge.jwebunit.api.IJWebUnitDialogpublic void saveAs(File f)
saveAs in interface net.sourceforge.jwebunit.api.IJWebUnitDialogpublic String getCurrentPageTitle()
TestContext.
public boolean hasFormInputNamed(String inputName)
inputName - name of the input element to check forpublic boolean hasFormSelectNamed(String selectName)
selectName - name of the input element to check forpublic com.gargoylesoftware.htmlunit.html.ClickableElement getSubmitButton(String buttonName)
buttonName - name of button.
public com.gargoylesoftware.htmlunit.html.HtmlResetInput getResetButton(String buttonName)
public com.gargoylesoftware.htmlunit.html.ClickableElement getSubmitButton(String buttonName,
String buttonValue)
buttonName - button name.buttonValue - button value.
public boolean hasSubmitButton()
hasSubmitButton in interface net.sourceforge.jwebunit.api.IJWebUnitDialogpublic boolean hasSubmitButton(String buttonName)
hasSubmitButton in interface net.sourceforge.jwebunit.api.IJWebUnitDialog
public boolean hasSubmitButton(String buttonName,
String buttonValue)
hasSubmitButton in interface net.sourceforge.jwebunit.api.IJWebUnitDialogpublic boolean hasResetButton()
hasResetButton in interface net.sourceforge.jwebunit.api.IJWebUnitDialogpublic boolean hasResetButton(String buttonName)
hasResetButton in interface net.sourceforge.jwebunit.api.IJWebUnitDialogpublic boolean hasButtonWithText(String text)
text is present.
hasButtonWithText in interface net.sourceforge.jwebunit.api.IJWebUnitDialogtext - the text of the button (between <button></button>).
true when the button with text could be found.public com.gargoylesoftware.htmlunit.html.HtmlButton getButtonWithText(String buttonValueText)
public boolean hasButton(String buttonId)
buttonId is present.
hasButton in interface net.sourceforge.jwebunit.api.IJWebUnitDialogbuttonId - the id of the button
true when the button was found.public boolean isCheckboxSelected(String checkBoxName)
isCheckboxSelected in interface net.sourceforge.jwebunit.api.IJWebUnitDialog
public boolean isCheckboxSelected(String checkBoxName,
String checkBoxValue)
isCheckboxSelected in interface net.sourceforge.jwebunit.api.IJWebUnitDialog
public boolean isTextInTable(String tableSummaryOrId,
String text)
tableSummaryOrId - table summary or id to inspect for expected text.text - expected text to check for.public net.sourceforge.jwebunit.html.Table getTable(String tableSummaryOrId)
getTable in interface net.sourceforge.jwebunit.api.IJWebUnitDialogpublic com.gargoylesoftware.htmlunit.html.HtmlTable getHtmlTable(String tableSummaryOrId)
tableSummaryOrId - summary or id of the table to return.public boolean hasTable(String tableSummaryOrId)
hasTable in interface net.sourceforge.jwebunit.api.IJWebUnitDialogpublic void submit()
#getFormfor an explanation of how the
current form is established.
submit in interface net.sourceforge.jwebunit.api.IJWebUnitDialogpublic void submit(String buttonName)
#getFormfor an explanation of how the
current form is established.
submit in interface net.sourceforge.jwebunit.api.IJWebUnitDialogbuttonName - name of the button to use for submission.
public void submit(String buttonName,
String buttonValue)
#getFormfor an
explanation of how the current form is established.
submit in interface net.sourceforge.jwebunit.api.IJWebUnitDialogbuttonName - name of the button to use for submission.buttonValue - value/label of the button to use for submissionpublic void reset()
#getFormfor an explanation of how the current form is established.
reset in interface net.sourceforge.jwebunit.api.IJWebUnitDialog
public boolean hasLinkWithText(String linkText,
int index)
hasLinkWithText in interface net.sourceforge.jwebunit.api.IJWebUnitDialoglinkText - 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)
hasLinkWithExactText in interface net.sourceforge.jwebunit.api.IJWebUnitDialog
public boolean hasLinkWithImage(String imageFileName,
int index)
hasLinkWithImage in interface net.sourceforge.jwebunit.api.IJWebUnitDialogpublic boolean hasLink(String anId)
hasLink in interface net.sourceforge.jwebunit.api.IJWebUnitDialoganId - link id to check for.
public void clickLinkWithText(String linkText,
int index)
clickLinkWithText in interface net.sourceforge.jwebunit.api.IJWebUnitDialog
public void clickLinkWithExactText(String linkText,
int index)
clickLinkWithExactText in interface net.sourceforge.jwebunit.api.IJWebUnitDialogpublic void checkCheckbox(String checkBoxName)
checkCheckbox in interface net.sourceforge.jwebunit.api.IJWebUnitDialogcheckBoxName - name of checkbox to be deselected.
public void checkCheckbox(String checkBoxName,
String value)
checkCheckbox in interface net.sourceforge.jwebunit.api.IJWebUnitDialogpublic void uncheckCheckbox(String checkBoxName)
uncheckCheckbox in interface net.sourceforge.jwebunit.api.IJWebUnitDialogcheckBoxName - name of checkbox to be deselected.
public void uncheckCheckbox(String checkBoxName,
String value)
uncheckCheckbox in interface net.sourceforge.jwebunit.api.IJWebUnitDialog
public void clickRadioOption(String radioGroup,
String radioOption)
clickRadioOption in interface net.sourceforge.jwebunit.api.IJWebUnitDialogradioGroup - name of the radio group.radioOption - value of the option to check for.public void clickLink(String anID)
clickLink in interface net.sourceforge.jwebunit.api.IJWebUnitDialoganID - id of link to be navigated.
public void clickLinkWithImage(String imageFileName,
int index)
clickLinkWithImage in interface net.sourceforge.jwebunit.api.IJWebUnitDialogimageFileName - A suffix of the image's filename; for example, to match
"images/my_icon.png", you could just pass in
"my_icon.png".public boolean hasElement(String anID)
hasElement in interface net.sourceforge.jwebunit.api.IJWebUnitDialogpublic boolean hasElementByXPath(String xpath)
hasElementByXPath in interface net.sourceforge.jwebunit.api.IJWebUnitDialogpublic void clickElementByXPath(String xpath)
clickElementByXPath in interface net.sourceforge.jwebunit.api.IJWebUnitDialog
public String getElementAttributByXPath(String xpath,
String attribut)
getElementAttributByXPath in interface net.sourceforge.jwebunit.api.IJWebUnitDialogpublic void clickButton(String buttonId)
clickButton in interface net.sourceforge.jwebunit.api.IJWebUnitDialogbuttonId - public void clickButtonWithText(String buttonValueText)
clickButtonWithText in interface net.sourceforge.jwebunit.api.IJWebUnitDialog
public boolean hasRadioOption(String radioGroup,
String radioOption)
hasRadioOption in interface net.sourceforge.jwebunit.api.IJWebUnitDialogradioGroup - name of the radio group.radioOption - value of the option to check for.
public boolean hasSelectOption(String selectName,
String optionLabel)
hasSelectOption in interface net.sourceforge.jwebunit.api.IJWebUnitDialogselectName - name of the select box.optionLabel - label of the option.
public boolean hasSelectOptionValue(String selectName,
String optionValue)
hasSelectOptionValue in interface net.sourceforge.jwebunit.api.IJWebUnitDialogselectName - name of the select box.optionValue - value of the option.
public void selectOptions(String selectName,
String[] options)
selectOptions in interface net.sourceforge.jwebunit.api.IJWebUnitDialog
public void unselectOptions(String selectName,
String[] options)
unselectOptions in interface net.sourceforge.jwebunit.api.IJWebUnitDialog
public boolean isTextInElement(String elementID,
String text)
isTextInElement in interface net.sourceforge.jwebunit.api.IJWebUnitDialog
public boolean isMatchInElement(String elementID,
String regexp)
isMatchInElement in interface net.sourceforge.jwebunit.api.IJWebUnitDialogpublic void gotoRootWindow()
gotoRootWindow in interface net.sourceforge.jwebunit.api.IJWebUnitDialog
public void setExpectedJavaScriptAlert(net.sourceforge.jwebunit.javascript.JavascriptAlert[] alerts)
throws net.sourceforge.jwebunit.exception.ExpectedJavascriptAlertException
setExpectedJavaScriptAlert in interface net.sourceforge.jwebunit.api.IJWebUnitDialognet.sourceforge.jwebunit.exception.ExpectedJavascriptAlertException
public void setExpectedJavaScriptConfirm(net.sourceforge.jwebunit.javascript.JavascriptConfirm[] confirms)
throws net.sourceforge.jwebunit.exception.ExpectedJavascriptConfirmException
setExpectedJavaScriptConfirm in interface net.sourceforge.jwebunit.api.IJWebUnitDialognet.sourceforge.jwebunit.exception.ExpectedJavascriptConfirmException
public void setExpectedJavaScriptPrompt(net.sourceforge.jwebunit.javascript.JavascriptPrompt[] prompts)
throws net.sourceforge.jwebunit.exception.ExpectedJavascriptPromptException
setExpectedJavaScriptPrompt in interface net.sourceforge.jwebunit.api.IJWebUnitDialognet.sourceforge.jwebunit.exception.ExpectedJavascriptPromptException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||