|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--net.sourceforge.jwebunit.HttpUnitDialog
Acts as the wrapper for HttpUnit access. A dialog is initialized with a given URL, and maintains conversational state as the dialog progresses through link navigation, form submission, etc. Public access is provided for wrappered HttpUnit objects.
Constructor Summary | |
HttpUnitDialog(java.lang.String initialURL,
TestContext context)
Begin a dialog with an initial URL and test client context. |
Method Summary | |
void |
clickButton(java.lang.String buttonId)
Click the indicated button (input type=button). |
void |
clickLink(java.lang.String anID)
Navigate by submitting a request based on a link with a given ID. |
void |
clickLinkWithImage(java.lang.String imageFileName)
Navigate by submitting a request based on a link with a given image file name. |
void |
clickLinkWithText(java.lang.String linkText)
Navigate by submitting a request based on a link containing the specified text. |
com.meterware.httpunit.Button |
getButton(java.lang.String buttonId)
Return the HttpUnit Button with a given id. |
org.w3c.dom.Element |
getElement(java.lang.String anID)
Return the org.w3c.dom.Element in the current response by id. |
com.meterware.httpunit.WebForm |
getForm()
Return the current form active for the dialog. |
java.lang.String |
getFormElementNameForLabel(java.lang.String formElementLabel)
Return the name of a form parameter (input element) on the current response preceded by a givel label. |
java.lang.String |
getFormParameterValue(java.lang.String paramName)
Return the current value of a form input element. |
com.meterware.httpunit.WebResponse |
getFrame(java.lang.String frameName)
Return the response for the given frame in the current conversation. |
java.lang.String[] |
getOptionsFor(java.lang.String selectName)
Return a string array of select box option labels. |
java.lang.String[] |
getOptionValuesFor(java.lang.String selectName)
Return a string array of select box option values. |
com.meterware.httpunit.WebResponse |
getResponse()
Return the HttpUnit object which represents the current response. |
java.lang.String |
getResponsePageTitle()
Return the page title of the current response page, encoded as specified by the current TestContext . |
java.lang.String |
getResponseText()
Return the string representation of the current response, encoded as specified by the current TestContext . |
java.lang.String |
getSelectedOption(java.lang.String selectName)
Return the label of the currently selected item in a select box. |
java.lang.String[][] |
getSparseTableBySummaryOrId(java.lang.String tableSummaryOrId)
Return a sparse array (rows or columns without displayable text are removed) for a given table in the response. |
com.meterware.httpunit.SubmitButton |
getSubmitButton(java.lang.String buttonName)
Return the HttpUnit SubmitButton with a given name. |
java.lang.String |
getValueForOption(java.lang.String selectName,
java.lang.String option)
Get the value for a given option of a select box. |
com.meterware.httpunit.WebConversation |
getWebConversation()
Return the HttpUnit WebConversation object for this dialog. |
com.meterware.httpunit.WebTable |
getWebTableBySummaryOrId(java.lang.String tableSummaryOrId)
Return the HttpUnit WebTable object representing a specified table in the current response. |
com.meterware.httpunit.WebWindow |
getWindow(java.lang.String windowName)
Return the window with the given name in the current conversation. |
void |
gotoFrame(java.lang.String frameName)
Make the frame with the given name active in the current conversation. |
void |
gotoRootWindow()
Make the root window in the current conversation active. |
void |
gotoWindow(java.lang.String windowName)
Make the window with the given name in the current conversation active. |
boolean |
hasForm()
Return true if the current response contains a form. |
boolean |
hasForm(java.lang.String nameOrID)
Return true if the current response contains a specific form. |
boolean |
hasFormParameterLabeled(java.lang.String paramLabel)
Return true if a form parameter (input element) is present on the current response preceded by a given label. |
boolean |
hasFormParameterNamed(java.lang.String paramName)
Return true if a form parameter (input element) is present on the current response. |
boolean |
hasRadioOption(java.lang.String radioGroup,
java.lang.String radioOption)
Return true if a radio group contains the indicated option. |
boolean |
isLinkPresent(java.lang.String anId)
Return true if a link is present in the current response with the specified id. |
boolean |
isLinkPresentWithImage(java.lang.String imageFileName)
Return true if a link is present with a given image based on filename of image. |
boolean |
isLinkPresentWithText(java.lang.String linkText)
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 |
isTextInElement(org.w3c.dom.Element element,
java.lang.String text)
Return true if a given string is contained within the specified element. |
boolean |
isTextInResponse(java.lang.String text)
Return true if given text is present anywhere in the current response. |
boolean |
isTextInTable(java.lang.String tableSummaryOrId,
java.lang.String text)
Return true if given text is present in a specified table of the response. |
void |
removeFormParameter(java.lang.String paramName)
Specify that no parameter value should be submitted for a given input element. |
void |
reset()
Reset the current form. |
void |
selectOption(java.lang.String selectName,
java.lang.String option)
Select an option of a select box by display label. |
void |
setFormParameter(java.lang.String paramName,
java.lang.String paramValue)
Set a form parameter / input element to the provided value. |
void |
setWorkingForm(java.lang.String nameOrId)
Set the form on the current response 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(java.lang.String buttonName)
Submit the current form with the specifed submit button. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public HttpUnitDialog(java.lang.String initialURL, TestContext context)
initialURL
- absolute url at which to begin dialog.context
- contains context information for the test client.Method Detail |
public com.meterware.httpunit.WebConversation getWebConversation()
public com.meterware.httpunit.WebResponse getResponse()
public java.lang.String getResponseText()
TestContext
.public java.lang.String getResponsePageTitle()
TestContext
.public com.meterware.httpunit.WebForm getForm()
Return the current form active for the dialog. A form from the dialog's response is implicitly identified as active when an element from the form is inspected or set:
getFormParameterValue(java.lang.String)
hasFormParameterNamed(java.lang.String)
getSubmitButton(java.lang.String)
setFormParameter(java.lang.String, java.lang.String)
The active form can also be explicitly set by setWorkingForm(java.lang.String)
.
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 response.
UnableToSetFormException
- This runtime assertion failure will be raised if there is
no form on the response.public void setWorkingForm(java.lang.String nameOrId)
nameOrId
- name or id of the form to be worked with.public boolean hasForm()
public boolean hasForm(java.lang.String nameOrID)
nameOrID
- name of id of the form to check for.public boolean hasFormParameterNamed(java.lang.String paramName)
paramName
- name of the input element to check forpublic void setFormParameter(java.lang.String paramName, java.lang.String paramValue)
paramName
- name of the input elementparamValue
- parameter value to submit for the element.public java.lang.String getFormParameterValue(java.lang.String paramName)
paramName
- name of the input element.public void removeFormParameter(java.lang.String paramName)
paramName
- name of the input element.public boolean hasFormParameterLabeled(java.lang.String paramLabel)
paramLabel
- label of the input element to check forpublic java.lang.String getFormElementNameForLabel(java.lang.String formElementLabel)
formElementLabel
- label of the input element to fetch name.public com.meterware.httpunit.SubmitButton getSubmitButton(java.lang.String buttonName)
buttonName
- name of button.public com.meterware.httpunit.Button getButton(java.lang.String buttonId)
buttonId
- public boolean isTextInResponse(java.lang.String text)
text
- string to check for.public boolean isTextInTable(java.lang.String tableSummaryOrId, java.lang.String text)
tableSummaryOrId
- table summary or id to inspect for expected text.text
- expected text to check for.public com.meterware.httpunit.WebTable getWebTableBySummaryOrId(java.lang.String tableSummaryOrId)
tableSummaryOrId
- summary or id of the table to return.public java.lang.String[][] getSparseTableBySummaryOrId(java.lang.String tableSummaryOrId)
tableSummaryOrId
- summary or id of the table.public void submit()
getForm()
for an explanation of how the current form is established.public void submit(java.lang.String buttonName)
getForm()
for an explanation of how the current form is established.buttonName
- name of the button to use for submission.public void reset()
getForm()
for an explanation of how the current form is established.public boolean isLinkPresentWithText(java.lang.String linkText)
linkText
- text to check for in links on the response.public boolean isLinkPresentWithImage(java.lang.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 boolean isLinkPresent(java.lang.String anId)
anId
- link id to check for.public void clickLinkWithText(java.lang.String linkText)
linkText
- text which link to be navigated should contain.public void clickLink(java.lang.String anID)
anID
- id of link to be navigated.public void clickLinkWithImage(java.lang.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 void clickButton(java.lang.String buttonId)
buttonId
- public boolean hasRadioOption(java.lang.String radioGroup, java.lang.String radioOption)
radioGroup
- name of the radio group.radioOption
- value of the option to check for.public java.lang.String[] getOptionsFor(java.lang.String selectName)
selectName
- name of the select box.public java.lang.String[] getOptionValuesFor(java.lang.String selectName)
selectName
- name of the select box.public java.lang.String getSelectedOption(java.lang.String selectName)
selectName
- name of the select box.public java.lang.String getValueForOption(java.lang.String selectName, java.lang.String option)
selectName
- name of the select box.option
- label of the option.public void selectOption(java.lang.String selectName, java.lang.String option)
selectName
- name of the select box.option
- label of the option to select.public org.w3c.dom.Element getElement(java.lang.String anID)
anID
- id of the element.public boolean isTextInElement(org.w3c.dom.Element element, java.lang.String text)
element
- org.w3c.com.Element to inspect.text
- text to check for.public com.meterware.httpunit.WebWindow getWindow(java.lang.String windowName)
windowName
- public void gotoWindow(java.lang.String windowName)
windowName
- public void gotoRootWindow()
public void gotoFrame(java.lang.String frameName)
frameName
- public com.meterware.httpunit.WebResponse getFrame(java.lang.String frameName)
frameName
-
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |