com.atlassian.confluence.htmlunit
Class HtmlUnitDialog

java.lang.Object
  extended by com.atlassian.confluence.htmlunit.HtmlUnitDialog
All Implemented Interfaces:
net.sourceforge.jwebunit.api.IJWebUnitDialog
Direct Known Subclasses:
ConfluenceHtmlUnitDialog

public class HtmlUnitDialog
extends java.lang.Object
implements net.sourceforge.jwebunit.api.IJWebUnitDialog

An exact copy of HtmlUnitDialog from JWebUnit 1.4.1-atlassian-1, with some private methods and fields changed to protected to ConfluenceHtmlUnitDialog can override them. Don't change this class, except to change private methods or fields to protected.


Field Summary
protected  java.util.LinkedList expectedJavascriptAlerts
          Javascript alerts.
protected  java.util.LinkedList expectedJavascriptConfirms
          Javascript confirms.
protected  java.util.LinkedList expectedJavascriptPrompts
          Javascript prompts.
protected  com.gargoylesoftware.htmlunit.html.HtmlForm form
          The currently selected form.
protected  boolean jsEnabled
          Is Javascript enabled.
protected  com.gargoylesoftware.htmlunit.WebClient wc
          Encapsulate browser abilities.
protected  com.gargoylesoftware.htmlunit.WebWindow win
          The currently selected window.
 
Constructor Summary
HtmlUnitDialog()
           
 
Method Summary
 void beginAt(java.net.URL initialURL, net.sourceforge.jwebunit.util.TestContext context)
          Begin a dialog with an initial URL and test client context.
 void checkCheckbox(java.lang.String checkBoxName)
          Select a specified checkbox.
 void checkCheckbox(java.lang.String checkBoxName, java.lang.String value)
           
 void clickButton(java.lang.String buttonId)
          Click the indicated button (input type=button).
 void clickButtonWithText(java.lang.String buttonValueText)
           
 void clickElementByXPath(java.lang.String xpath)
           
 void clickLink(java.lang.String anID)
          Navigate by submitting a request based on a link with a given ID.
 void clickLinkWithExactText(java.lang.String linkText, int index)
           
 void clickLinkWithImage(java.lang.String imageFileName, int index)
          Navigate by submitting a request based on a link with a given image file name.
 void clickLinkWithText(java.lang.String linkText, int index)
           
 void clickRadioOption(java.lang.String radioGroup, java.lang.String radioOption)
          Clicks a radio option.
 void closeBrowser()
           
 void closeWindow()
           
 com.gargoylesoftware.htmlunit.html.HtmlButton getButtonWithText(java.lang.String buttonValueText)
           
 java.util.List getCookies()
           
protected  com.gargoylesoftware.htmlunit.html.HtmlPage getCurrentPage()
           
 java.lang.String getCurrentPageTitle()
          Return the page title of the current response page, encoded as specified by the current TestContext.
protected  com.gargoylesoftware.htmlunit.html.HtmlElement getElement(java.lang.String anID)
           
 java.lang.String getElementAttributByXPath(java.lang.String xpath, java.lang.String attribut)
           
 java.lang.String getElementTextByXPath(java.lang.String xpath)
           
protected  com.gargoylesoftware.htmlunit.html.HtmlForm getForm()
           Return the current form active for the dialog.
 java.lang.String getHiddenFieldValue(java.lang.String paramName)
          Return the current value of a hidden input element with name paramName.
 com.gargoylesoftware.htmlunit.html.HtmlTable getHtmlTable(java.lang.String tableSummaryOrId)
          Return the HttpUnit WebTable object representing a specified table in the current response.
 java.io.InputStream getInputStream()
           
 java.io.InputStream getInputStream(java.net.URL resourceUrl)
           
 java.lang.String getPageSource()
           
 java.lang.String getPageText()
           
 java.lang.String getPageTitle()
           
 java.net.URL getPageURL()
           
 com.gargoylesoftware.htmlunit.html.HtmlResetInput getResetButton(java.lang.String buttonName)
           
 java.lang.String[] getSelectedOptions(java.lang.String selectName)
           
 java.lang.String getSelectedRadio(java.lang.String radioGroup)
           
 java.lang.String getSelectOptionLabelForValue(java.lang.String selectName, java.lang.String value)
           
 java.lang.String getSelectOptionValueForLabel(java.lang.String selectName, java.lang.String label)
           
 java.lang.String[] getSelectOptionValues(java.lang.String selectName)
          Return a string array of select box option values.
 java.lang.String getServerResponse()
           
 com.gargoylesoftware.htmlunit.html.ClickableElement getSubmitButton(java.lang.String buttonName)
          Return the HtmlUnit submit button with a given name.
 com.gargoylesoftware.htmlunit.html.ClickableElement getSubmitButton(java.lang.String buttonName, java.lang.String buttonValue)
          Return the HtmlUnit submit button with a given name and value.
 net.sourceforge.jwebunit.html.Table getTable(java.lang.String tableSummaryOrId)
           
protected  net.sourceforge.jwebunit.util.TestContext getTestContext()
           
 java.lang.String getTextFieldValue(java.lang.String paramName)
          Return the current value of a text input element with name paramName.
 int getWindowCount()
           
 void gotoFrame(java.lang.String frameNameOrId)
          
 void gotoPage(java.net.URL initialURL)
           
 void gotoRootWindow()
          Make the root window in the current conversation active.
 void gotoWindow(int windowID)
           
 void gotoWindow(java.lang.String windowName)
          Make the window with the given name in the current conversation active.
 void gotoWindowByTitle(java.lang.String title)
          Goto first window with the given title.
 boolean hasButton(java.lang.String buttonId)
          Returns if the button identified by buttonId is present.
 boolean hasButtonWithText(java.lang.String text)
          Checks if a button with text is present.
 boolean hasElement(java.lang.String anID)
           
 boolean hasElementByXPath(java.lang.String xpath)
           
 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 hasFormInputNamed(java.lang.String inputName)
          Return true if a form parameter (input element) is present on the current response.
 boolean hasFormParameterNamed(java.lang.String paramName)
           
 boolean hasFormSelectNamed(java.lang.String selectName)
          Return true if a form parameter (input element) is present on the current response.
 boolean hasFrame(java.lang.String frameNameOrId)
          
 boolean hasLink(java.lang.String anId)
          Return true if a link is present in the current response with the specified id.
 boolean hasLinkWithExactText(java.lang.String linkText, int index)
           
 boolean hasLinkWithImage(java.lang.String imageFileName, int index)
           
 boolean hasLinkWithText(java.lang.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(java.lang.String radioGroup, java.lang.String radioOption)
          Return true if a radio group contains the indicated option.
 boolean hasResetButton()
           
 boolean hasResetButton(java.lang.String buttonName)
           
 boolean hasSelectOption(java.lang.String selectName, java.lang.String optionLabel)
          Return true if a select box contains the indicated option.
 boolean hasSelectOptionValue(java.lang.String selectName, java.lang.String optionValue)
          Return true if a select box contains the indicated option.
 boolean hasSubmitButton()
          
 boolean hasSubmitButton(java.lang.String buttonName)
          
 boolean hasSubmitButton(java.lang.String buttonName, java.lang.String buttonValue)
          
 boolean hasTable(java.lang.String tableSummaryOrId)
           
 boolean hasWindow(java.lang.String windowName)
           
 boolean hasWindowByTitle(java.lang.String title)
           
protected  void initWebClient()
           
 boolean isCheckboxSelected(java.lang.String checkBoxName)
           
 boolean isCheckboxSelected(java.lang.String checkBoxName, java.lang.String checkBoxValue)
           
 boolean isMatchInElement(java.lang.String elementID, java.lang.String regexp)
           
 boolean isTextInElement(java.lang.String elementID, java.lang.String text)
           
 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 reset()
          Reset the current form.
 void selectOptions(java.lang.String selectName, java.lang.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(java.lang.String fieldName, java.lang.String text)
          Set a form text, password input element or textarea to the provided value.
 void setWorkingForm(int index)
          
 void setWorkingForm(java.lang.String nameOrId, int index)
          
 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.
 void submit(java.lang.String buttonName, java.lang.String buttonValue)
          Submit the current form with the specifed submit button (by name and value).
 void uncheckCheckbox(java.lang.String checkBoxName)
          Deselect a specified checkbox.
 void uncheckCheckbox(java.lang.String checkBoxName, java.lang.String value)
           
 void unselectOptions(java.lang.String selectName, java.lang.String[] options)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

wc

protected com.gargoylesoftware.htmlunit.WebClient wc
Encapsulate browser abilities.


win

protected com.gargoylesoftware.htmlunit.WebWindow win
The currently selected window.


form

protected com.gargoylesoftware.htmlunit.html.HtmlForm form
The currently selected form.


jsEnabled

protected boolean jsEnabled
Is Javascript enabled.


expectedJavascriptAlerts

protected java.util.LinkedList expectedJavascriptAlerts
Javascript alerts.


expectedJavascriptConfirms

protected java.util.LinkedList expectedJavascriptConfirms
Javascript confirms.


expectedJavascriptPrompts

protected java.util.LinkedList expectedJavascriptPrompts
Javascript prompts.

Constructor Detail

HtmlUnitDialog

public HtmlUnitDialog()
Method Detail

beginAt

public void beginAt(java.net.URL initialURL,
                    net.sourceforge.jwebunit.util.TestContext context)
             throws net.sourceforge.jwebunit.exception.TestingEngineResponseException
Begin a dialog with an initial URL and test client context.

Specified by:
beginAt in interface net.sourceforge.jwebunit.api.IJWebUnitDialog
Parameters:
initialURL - absolute url at which to begin dialog.
context - contains context information for the test client.
Throws:
net.sourceforge.jwebunit.exception.TestingEngineResponseException

closeBrowser

public void closeBrowser()
                  throws net.sourceforge.jwebunit.exception.ExpectedJavascriptAlertException,
                         net.sourceforge.jwebunit.exception.ExpectedJavascriptConfirmException,
                         net.sourceforge.jwebunit.exception.ExpectedJavascriptPromptException
Specified by:
closeBrowser in interface net.sourceforge.jwebunit.api.IJWebUnitDialog
Throws:
net.sourceforge.jwebunit.exception.ExpectedJavascriptAlertException
net.sourceforge.jwebunit.exception.ExpectedJavascriptConfirmException
net.sourceforge.jwebunit.exception.ExpectedJavascriptPromptException

gotoPage

public void gotoPage(java.net.URL initialURL)
              throws net.sourceforge.jwebunit.exception.TestingEngineResponseException
Specified by:
gotoPage in interface net.sourceforge.jwebunit.api.IJWebUnitDialog
Throws:
net.sourceforge.jwebunit.exception.TestingEngineResponseException

setScriptingEnabled

public void setScriptingEnabled(boolean value)
Specified by:
setScriptingEnabled in interface net.sourceforge.jwebunit.api.IJWebUnitDialog
See Also:
IJWebUnitDialog.setScriptingEnabled(boolean)

getCookies

public java.util.List getCookies()
Specified by:
getCookies in interface net.sourceforge.jwebunit.api.IJWebUnitDialog

hasWindow

public boolean hasWindow(java.lang.String windowName)
Specified by:
hasWindow in interface net.sourceforge.jwebunit.api.IJWebUnitDialog

hasWindowByTitle

public boolean hasWindowByTitle(java.lang.String title)
Specified by:
hasWindowByTitle in interface net.sourceforge.jwebunit.api.IJWebUnitDialog

gotoWindow

public void gotoWindow(java.lang.String windowName)
Make the window with the given name in the current conversation active.

Specified by:
gotoWindow in interface net.sourceforge.jwebunit.api.IJWebUnitDialog
Parameters:
windowName -

gotoWindow

public void gotoWindow(int windowID)
Specified by:
gotoWindow in interface net.sourceforge.jwebunit.api.IJWebUnitDialog

getWindowCount

public int getWindowCount()
Specified by:
getWindowCount in interface net.sourceforge.jwebunit.api.IJWebUnitDialog

gotoWindowByTitle

public void gotoWindowByTitle(java.lang.String title)
Goto first window with the given title.

Specified by:
gotoWindowByTitle in interface net.sourceforge.jwebunit.api.IJWebUnitDialog
Parameters:
title -

closeWindow

public void closeWindow()
Specified by:
closeWindow in interface net.sourceforge.jwebunit.api.IJWebUnitDialog

hasFrame

public boolean hasFrame(java.lang.String frameNameOrId)

Specified by:
hasFrame in interface net.sourceforge.jwebunit.api.IJWebUnitDialog

gotoFrame

public void gotoFrame(java.lang.String frameNameOrId)

Specified by:
gotoFrame in interface net.sourceforge.jwebunit.api.IJWebUnitDialog

setWorkingForm

public void setWorkingForm(int index)

Specified by:
setWorkingForm in interface net.sourceforge.jwebunit.api.IJWebUnitDialog

setWorkingForm

public void setWorkingForm(java.lang.String nameOrId,
                           int index)

Specified by:
setWorkingForm in interface net.sourceforge.jwebunit.api.IJWebUnitDialog

hasForm

public boolean hasForm()
Return true if the current response contains a form.

Specified by:
hasForm in interface net.sourceforge.jwebunit.api.IJWebUnitDialog

hasForm

public boolean hasForm(java.lang.String nameOrID)
Return true if the current response contains a specific form.

Specified by:
hasForm in interface net.sourceforge.jwebunit.api.IJWebUnitDialog
Parameters:
nameOrID - name of id of the form to check for.

hasFormParameterNamed

public boolean hasFormParameterNamed(java.lang.String paramName)
Specified by:
hasFormParameterNamed in interface net.sourceforge.jwebunit.api.IJWebUnitDialog

getTextFieldValue

public java.lang.String getTextFieldValue(java.lang.String paramName)
Return the current value of a text input element with name paramName.

Specified by:
getTextFieldValue in interface net.sourceforge.jwebunit.api.IJWebUnitDialog
Parameters:
paramName - name of the input element. TODO: Find a way to handle multiple text input element with same name.

getHiddenFieldValue

public java.lang.String getHiddenFieldValue(java.lang.String paramName)
Return the current value of a hidden input element with name paramName.

Specified by:
getHiddenFieldValue in interface net.sourceforge.jwebunit.api.IJWebUnitDialog
Parameters:
paramName - name of the input element. TODO: Find a way to handle multiple hidden input element with same name.

setTextField

public void setTextField(java.lang.String fieldName,
                         java.lang.String text)
Set a form text, password input element or textarea to the provided value.

Specified by:
setTextField in interface net.sourceforge.jwebunit.api.IJWebUnitDialog
Parameters:
fieldName - name of the input element or textarea
text - parameter value to submit for the element.

getSelectOptionValues

public java.lang.String[] getSelectOptionValues(java.lang.String selectName)
Return a string array of select box option values.

Specified by:
getSelectOptionValues in interface net.sourceforge.jwebunit.api.IJWebUnitDialog
Parameters:
selectName - name of the select box.

getSelectedOptions

public java.lang.String[] getSelectedOptions(java.lang.String selectName)
Specified by:
getSelectedOptions in interface net.sourceforge.jwebunit.api.IJWebUnitDialog

getSelectOptionValueForLabel

public java.lang.String getSelectOptionValueForLabel(java.lang.String selectName,
                                                     java.lang.String label)
Specified by:
getSelectOptionValueForLabel in interface net.sourceforge.jwebunit.api.IJWebUnitDialog

getSelectOptionLabelForValue

public java.lang.String getSelectOptionLabelForValue(java.lang.String selectName,
                                                     java.lang.String value)
Specified by:
getSelectOptionLabelForValue in interface net.sourceforge.jwebunit.api.IJWebUnitDialog

getPageURL

public java.net.URL getPageURL()
Specified by:
getPageURL in interface net.sourceforge.jwebunit.api.IJWebUnitDialog

getPageSource

public java.lang.String getPageSource()
Specified by:
getPageSource in interface net.sourceforge.jwebunit.api.IJWebUnitDialog

getPageTitle

public java.lang.String getPageTitle()
Specified by:
getPageTitle in interface net.sourceforge.jwebunit.api.IJWebUnitDialog

getPageText

public java.lang.String getPageText()
Specified by:
getPageText in interface net.sourceforge.jwebunit.api.IJWebUnitDialog

getServerResponse

public java.lang.String getServerResponse()
Specified by:
getServerResponse in interface net.sourceforge.jwebunit.api.IJWebUnitDialog

getInputStream

public java.io.InputStream getInputStream()
Specified by:
getInputStream in interface net.sourceforge.jwebunit.api.IJWebUnitDialog

getInputStream

public java.io.InputStream getInputStream(java.net.URL resourceUrl)
                                   throws net.sourceforge.jwebunit.exception.TestingEngineResponseException
Specified by:
getInputStream in interface net.sourceforge.jwebunit.api.IJWebUnitDialog
Throws:
net.sourceforge.jwebunit.exception.TestingEngineResponseException

initWebClient

protected void initWebClient()

getElement

protected com.gargoylesoftware.htmlunit.html.HtmlElement getElement(java.lang.String anID)

getCurrentPageTitle

public java.lang.String getCurrentPageTitle()
Return the page title of the current response page, encoded as specified by the current TestContext.


getForm

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.

Returns:
HtmlForm object representing the current active form from the response.
Throws:
net.sourceforge.jwebunit.exception.UnableToSetFormException - This runtime assertion failure will be raised if there is no form on the response.

getCurrentPage

protected com.gargoylesoftware.htmlunit.html.HtmlPage getCurrentPage()

hasFormInputNamed

public boolean hasFormInputNamed(java.lang.String inputName)
Return true if a form parameter (input element) is present on the current response.

Parameters:
inputName - name of the input element to check for

hasFormSelectNamed

public boolean hasFormSelectNamed(java.lang.String selectName)
Return true if a form parameter (input element) is present on the current response.

Parameters:
selectName - name of the input element to check for

getSubmitButton

public com.gargoylesoftware.htmlunit.html.ClickableElement getSubmitButton(java.lang.String buttonName)
Return the HtmlUnit submit button with a given name.

Parameters:
buttonName - name of button.
Returns:
the button

getResetButton

public com.gargoylesoftware.htmlunit.html.HtmlResetInput getResetButton(java.lang.String buttonName)

getSubmitButton

public com.gargoylesoftware.htmlunit.html.ClickableElement getSubmitButton(java.lang.String buttonName,
                                                                           java.lang.String buttonValue)
Return the HtmlUnit submit button with a given name and value.

Parameters:
buttonName - button name.
buttonValue - button value.
Returns:
HtmlSubmitInput, HtmlImageInput or HtmlButton

hasSubmitButton

public boolean hasSubmitButton()

Specified by:
hasSubmitButton in interface net.sourceforge.jwebunit.api.IJWebUnitDialog

hasSubmitButton

public boolean hasSubmitButton(java.lang.String buttonName)

Specified by:
hasSubmitButton in interface net.sourceforge.jwebunit.api.IJWebUnitDialog

hasSubmitButton

public boolean hasSubmitButton(java.lang.String buttonName,
                               java.lang.String buttonValue)

Specified by:
hasSubmitButton in interface net.sourceforge.jwebunit.api.IJWebUnitDialog

hasResetButton

public boolean hasResetButton()
Specified by:
hasResetButton in interface net.sourceforge.jwebunit.api.IJWebUnitDialog

hasResetButton

public boolean hasResetButton(java.lang.String buttonName)
Specified by:
hasResetButton in interface net.sourceforge.jwebunit.api.IJWebUnitDialog

hasButtonWithText

public boolean hasButtonWithText(java.lang.String text)
Checks if a button with text is present.

Specified by:
hasButtonWithText in interface net.sourceforge.jwebunit.api.IJWebUnitDialog
Parameters:
text - the text of the button (between <button></button>).
Returns:
true when the button with text could be found.

getButtonWithText

public com.gargoylesoftware.htmlunit.html.HtmlButton getButtonWithText(java.lang.String buttonValueText)

hasButton

public boolean hasButton(java.lang.String buttonId)
Returns if the button identified by buttonId is present.

Specified by:
hasButton in interface net.sourceforge.jwebunit.api.IJWebUnitDialog
Parameters:
buttonId - the id of the button
Returns:
true when the button was found.

isCheckboxSelected

public boolean isCheckboxSelected(java.lang.String checkBoxName)
Specified by:
isCheckboxSelected in interface net.sourceforge.jwebunit.api.IJWebUnitDialog

isCheckboxSelected

public boolean isCheckboxSelected(java.lang.String checkBoxName,
                                  java.lang.String checkBoxValue)
Specified by:
isCheckboxSelected in interface net.sourceforge.jwebunit.api.IJWebUnitDialog

isTextInTable

public boolean isTextInTable(java.lang.String tableSummaryOrId,
                             java.lang.String text)
Return true if given text is present in a specified table of the response.

Parameters:
tableSummaryOrId - table summary or id to inspect for expected text.
text - expected text to check for.

getTable

public net.sourceforge.jwebunit.html.Table getTable(java.lang.String tableSummaryOrId)
Specified by:
getTable in interface net.sourceforge.jwebunit.api.IJWebUnitDialog

getHtmlTable

public com.gargoylesoftware.htmlunit.html.HtmlTable getHtmlTable(java.lang.String tableSummaryOrId)
Return the HttpUnit WebTable object representing a specified table in the current response. Null is returned if a parsing exception occurs looking for the table or no table with the id or summary could be found. tableSummaryOrId can also match on the class of a table if its unique.

Parameters:
tableSummaryOrId - summary, class or id of the table to return.

hasTable

public boolean hasTable(java.lang.String tableSummaryOrId)
Specified by:
hasTable in interface net.sourceforge.jwebunit.api.IJWebUnitDialog

submit

public void submit()
Submit the current form with the default submit button. See getForm()for an explanation of how the current form is established.

Specified by:
submit in interface net.sourceforge.jwebunit.api.IJWebUnitDialog

submit

public void submit(java.lang.String buttonName)
Submit the current form with the specifed submit button. See getForm()for an explanation of how the current form is established.

Specified by:
submit in interface net.sourceforge.jwebunit.api.IJWebUnitDialog
Parameters:
buttonName - name of the button to use for submission.

submit

public void submit(java.lang.String buttonName,
                   java.lang.String buttonValue)
Submit the current form with the specifed submit button (by name and value). See getForm()for an explanation of how the current form is established.

Specified by:
submit in interface net.sourceforge.jwebunit.api.IJWebUnitDialog
Parameters:
buttonName - name of the button to use for submission.
buttonValue - value/label of the button to use for submission

reset

public void reset()
Reset the current form. See getForm()for an explanation of how the current form is established.

Specified by:
reset in interface net.sourceforge.jwebunit.api.IJWebUnitDialog

hasLinkWithText

public boolean hasLinkWithText(java.lang.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).

Specified by:
hasLinkWithText in interface net.sourceforge.jwebunit.api.IJWebUnitDialog
Parameters:
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.

hasLinkWithExactText

public boolean hasLinkWithExactText(java.lang.String linkText,
                                    int index)
Specified by:
hasLinkWithExactText in interface net.sourceforge.jwebunit.api.IJWebUnitDialog

hasLinkWithImage

public boolean hasLinkWithImage(java.lang.String imageFileName,
                                int index)
Specified by:
hasLinkWithImage in interface net.sourceforge.jwebunit.api.IJWebUnitDialog

hasLink

public boolean hasLink(java.lang.String anId)
Return true if a link is present in the current response with the specified id.

Specified by:
hasLink in interface net.sourceforge.jwebunit.api.IJWebUnitDialog
Parameters:
anId - link id to check for.

clickLinkWithText

public void clickLinkWithText(java.lang.String linkText,
                              int index)
Specified by:
clickLinkWithText in interface net.sourceforge.jwebunit.api.IJWebUnitDialog

clickLinkWithExactText

public void clickLinkWithExactText(java.lang.String linkText,
                                   int index)
Specified by:
clickLinkWithExactText in interface net.sourceforge.jwebunit.api.IJWebUnitDialog

checkCheckbox

public void checkCheckbox(java.lang.String checkBoxName)
Select a specified checkbox. If the checkbox is already checked then the checkbox will stay checked.

Specified by:
checkCheckbox in interface net.sourceforge.jwebunit.api.IJWebUnitDialog
Parameters:
checkBoxName - name of checkbox to be deselected.

checkCheckbox

public void checkCheckbox(java.lang.String checkBoxName,
                          java.lang.String value)
Specified by:
checkCheckbox in interface net.sourceforge.jwebunit.api.IJWebUnitDialog

uncheckCheckbox

public void uncheckCheckbox(java.lang.String checkBoxName)
Deselect a specified checkbox. If the checkbox is already unchecked then the checkbox will stay unchecked.

Specified by:
uncheckCheckbox in interface net.sourceforge.jwebunit.api.IJWebUnitDialog
Parameters:
checkBoxName - name of checkbox to be deselected.

uncheckCheckbox

public void uncheckCheckbox(java.lang.String checkBoxName,
                            java.lang.String value)
Specified by:
uncheckCheckbox in interface net.sourceforge.jwebunit.api.IJWebUnitDialog

clickRadioOption

public void clickRadioOption(java.lang.String radioGroup,
                             java.lang.String radioOption)
Clicks a radio option. Asserts that the radio option exists first. *

Specified by:
clickRadioOption in interface net.sourceforge.jwebunit.api.IJWebUnitDialog
Parameters:
radioGroup - name of the radio group.
radioOption - value of the option to check for.

clickLink

public void clickLink(java.lang.String anID)
Navigate by submitting a request based on a link with a given ID. A RuntimeException is thrown if no such link can be found.

Specified by:
clickLink in interface net.sourceforge.jwebunit.api.IJWebUnitDialog
Parameters:
anID - id of link to be navigated.

clickLinkWithImage

public void clickLinkWithImage(java.lang.String imageFileName,
                               int index)
Navigate by submitting a request based on a link with a given image file name. A RuntimeException is thrown if no such link can be found.

Specified by:
clickLinkWithImage in interface net.sourceforge.jwebunit.api.IJWebUnitDialog
Parameters:
imageFileName - A suffix of the image's filename; for example, to match "images/my_icon.png", you could just pass in "my_icon.png".

hasElement

public boolean hasElement(java.lang.String anID)
Specified by:
hasElement in interface net.sourceforge.jwebunit.api.IJWebUnitDialog

hasElementByXPath

public boolean hasElementByXPath(java.lang.String xpath)
Specified by:
hasElementByXPath in interface net.sourceforge.jwebunit.api.IJWebUnitDialog

clickElementByXPath

public void clickElementByXPath(java.lang.String xpath)
Specified by:
clickElementByXPath in interface net.sourceforge.jwebunit.api.IJWebUnitDialog

getElementAttributByXPath

public java.lang.String getElementAttributByXPath(java.lang.String xpath,
                                                  java.lang.String attribut)
Specified by:
getElementAttributByXPath in interface net.sourceforge.jwebunit.api.IJWebUnitDialog

getElementTextByXPath

public java.lang.String getElementTextByXPath(java.lang.String xpath)
Specified by:
getElementTextByXPath in interface net.sourceforge.jwebunit.api.IJWebUnitDialog

clickButton

public void clickButton(java.lang.String buttonId)
Click the indicated button (input type=button).

Specified by:
clickButton in interface net.sourceforge.jwebunit.api.IJWebUnitDialog
Parameters:
buttonId -

clickButtonWithText

public void clickButtonWithText(java.lang.String buttonValueText)
Specified by:
clickButtonWithText in interface net.sourceforge.jwebunit.api.IJWebUnitDialog

hasRadioOption

public boolean hasRadioOption(java.lang.String radioGroup,
                              java.lang.String radioOption)
Return true if a radio group contains the indicated option.

Specified by:
hasRadioOption in interface net.sourceforge.jwebunit.api.IJWebUnitDialog
Parameters:
radioGroup - name of the radio group.
radioOption - value of the option to check for.

getSelectedRadio

public java.lang.String getSelectedRadio(java.lang.String radioGroup)
Specified by:
getSelectedRadio in interface net.sourceforge.jwebunit.api.IJWebUnitDialog

hasSelectOption

public boolean hasSelectOption(java.lang.String selectName,
                               java.lang.String optionLabel)
Return true if a select box contains the indicated option.

Specified by:
hasSelectOption in interface net.sourceforge.jwebunit.api.IJWebUnitDialog
Parameters:
selectName - name of the select box.
optionLabel - label of the option.

hasSelectOptionValue

public boolean hasSelectOptionValue(java.lang.String selectName,
                                    java.lang.String optionValue)
Return true if a select box contains the indicated option.

Specified by:
hasSelectOptionValue in interface net.sourceforge.jwebunit.api.IJWebUnitDialog
Parameters:
selectName - name of the select box.
optionValue - value of the option.

selectOptions

public void selectOptions(java.lang.String selectName,
                          java.lang.String[] options)
Specified by:
selectOptions in interface net.sourceforge.jwebunit.api.IJWebUnitDialog

unselectOptions

public void unselectOptions(java.lang.String selectName,
                            java.lang.String[] options)
Specified by:
unselectOptions in interface net.sourceforge.jwebunit.api.IJWebUnitDialog

isTextInElement

public boolean isTextInElement(java.lang.String elementID,
                               java.lang.String text)
Specified by:
isTextInElement in interface net.sourceforge.jwebunit.api.IJWebUnitDialog

isMatchInElement

public boolean isMatchInElement(java.lang.String elementID,
                                java.lang.String regexp)
Specified by:
isMatchInElement in interface net.sourceforge.jwebunit.api.IJWebUnitDialog

gotoRootWindow

public void gotoRootWindow()
Make the root window in the current conversation active.

Specified by:
gotoRootWindow in interface net.sourceforge.jwebunit.api.IJWebUnitDialog

getTestContext

protected net.sourceforge.jwebunit.util.TestContext getTestContext()
Returns:
Returns the testContext.

setExpectedJavaScriptAlert

public void setExpectedJavaScriptAlert(net.sourceforge.jwebunit.javascript.JavascriptAlert[] alerts)
                                throws net.sourceforge.jwebunit.exception.ExpectedJavascriptAlertException
Specified by:
setExpectedJavaScriptAlert in interface net.sourceforge.jwebunit.api.IJWebUnitDialog
Throws:
net.sourceforge.jwebunit.exception.ExpectedJavascriptAlertException

setExpectedJavaScriptConfirm

public void setExpectedJavaScriptConfirm(net.sourceforge.jwebunit.javascript.JavascriptConfirm[] confirms)
                                  throws net.sourceforge.jwebunit.exception.ExpectedJavascriptConfirmException
Specified by:
setExpectedJavaScriptConfirm in interface net.sourceforge.jwebunit.api.IJWebUnitDialog
Throws:
net.sourceforge.jwebunit.exception.ExpectedJavascriptConfirmException

setExpectedJavaScriptPrompt

public void setExpectedJavaScriptPrompt(net.sourceforge.jwebunit.javascript.JavascriptPrompt[] prompts)
                                 throws net.sourceforge.jwebunit.exception.ExpectedJavascriptPromptException
Specified by:
setExpectedJavaScriptPrompt in interface net.sourceforge.jwebunit.api.IJWebUnitDialog
Throws:
net.sourceforge.jwebunit.exception.ExpectedJavascriptPromptException


Copyright © 2003-2010 Atlassian. All Rights Reserved.