net.sourceforge.jwebunit.api
Interface ITestingEngine

All Known Implementing Classes:
HtmlUnitTestingEngineImpl, SeleniumTestingEngineImpl

public interface ITestingEngine

This is the interface for all communications between JWebUnit and the specific running test engine.

Author:
Julien Henry, Nick Neuberger

Method Summary
 void beginAt(java.net.URL aInitialURL, TestContext aTestContext)
          Open the browser at an initial URL.
 void checkCheckbox(java.lang.String checkBoxName)
          Select a specified checkbox.
 void checkCheckbox(java.lang.String checkBoxName, java.lang.String checkBoxValue)
          Select a specified checkbox.
 void clickButton(java.lang.String buttonId)
          Click the indicated button.
 void clickButtonWithText(java.lang.String buttonValueText)
          Clicks a button with text of the value attribute.
 void clickElementByXPath(java.lang.String xpath)
          Click element with given 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)
          Navigate by clicking a link with the exact specified text.
 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)
          Navigate by submitting a request based on a link containing the specified text.
 void clickRadioOption(java.lang.String radioGroup, java.lang.String radioOptionValue)
          Clicks a radio option.
 void closeBrowser()
          Close the browser and check if there is no pending Javascript alert, confirm or prompt.
 void closeWindow()
          Close the current window.
 java.util.Map<java.lang.String,java.lang.String> getAllHeaders()
          Get all headers.
 java.util.List<java.lang.String> getComments()
          Get all the comments in a document, as a list of strings.
 java.util.List<?> getCookies()
          Get all cookies.
 java.lang.String getElementAttributByXPath(java.lang.String xpath, java.lang.String attribut)
          Get attribut value of the given element.
 IElement getElementByID(java.lang.String id)
          Get an element wrapper for a given ID.
 IElement getElementByXPath(java.lang.String xpath)
          Get an element wrapper for a given xpath.
 java.util.List<IElement> getElementsByXPath(java.lang.String xpath)
          Get a list of all elements that match the given xpath.
 java.lang.String getElementTextByXPath(java.lang.String xpath)
          Get text of the given element.
 java.lang.String getHeader(java.lang.String name)
          Get a particular header or null.
 java.lang.String getHiddenFieldValue(java.lang.String paramName)
          Return the current value of a hidden input element with name paramName.
 java.io.InputStream getInputStream()
          Gets the last server response as input stream.
 java.io.InputStream getInputStream(java.net.URL url)
          Gets the input stream for a given URL - can be used to test images or other resources without changing the current navigation context.
 java.lang.String getPageSource()
          Return the source of the current page (like in a browser).
 java.lang.String getPageText()
          Return the string representation of the current page, encoded as specified by the current TestContext.
 java.lang.String getPageTitle()
          Return the page title of the current response page, encoded as specified by the current TestContext.
 java.net.URL getPageURL()
          Get the location of the current page.
 java.lang.String[] getSelectedOptions(java.lang.String selectName)
          Return the values of the currently selected items in a select box.
 java.lang.String[] getSelectedOptions(java.lang.String selectName, int index)
          Return the values of the currently selected items in the Nth select box with the provided name.
 java.lang.String getSelectedRadio(java.lang.String radioGroup)
          Return the currently selected radio button.
 java.lang.String getSelectOptionLabelForValue(java.lang.String selectName, int index, java.lang.String optionValue)
          Get the label for a given option of the Nth select box with the specified name.
 java.lang.String getSelectOptionLabelForValue(java.lang.String selectName, java.lang.String optionValue)
          Get the label for a given option of a select box.
 java.lang.String getSelectOptionValueForLabel(java.lang.String selectName, int index, java.lang.String optionLabel)
          Get the value for a given option of the Nth select box with the specified name.
 java.lang.String getSelectOptionValueForLabel(java.lang.String selectName, java.lang.String optionLabel)
          Get the value for a given option of a select box.
 java.lang.String[] getSelectOptionValues(java.lang.String selectName)
          Return a string array of select box option values.
 java.lang.String[] getSelectOptionValues(java.lang.String selectName, int index)
          Return a string array of option values for the Nth select box with the specified name.
 java.lang.String getServerResponse()
          Return the response of the server for the current page.
 int getServerResponseCode()
          Get the request response code.
 Table getTable(java.lang.String tableSummaryNameOrId)
          Each framework have it's own way to represent a Table.
 java.lang.String getTextFieldValue(java.lang.String paramName)
          Return the current value of a text field with name paramName.
 int getWindowCount()
          Get the number of openend Windows.
 void gotoFrame(java.lang.String frameNameOrId)
          Make the frame with the given name or ID active in the current conversation.
 void gotoPage(java.net.URL url)
          Simulate user typing a new URL in the browser.
 void gotoRootWindow()
          Make the root window active.
 void gotoWindow(int windowID)
          Goto window with the given Javascript ID.
 void gotoWindow(java.lang.String windowName)
          Make the window with the given name active.
 void gotoWindowByTitle(java.lang.String title)
          Goto first window with the given title.
 boolean hasButton(java.lang.String buttonId)
          Checks if a button with id is present.
A button can be the following HTML elements: input type=button button type=button
 boolean hasButtonWithText(java.lang.String text)
          Checks if a button with text is present.
A button can be the following HTML elements: input type=button button type=button
 boolean hasElement(java.lang.String anID)
          Test if element with given id exists.
 boolean hasElementByXPath(java.lang.String xpath)
          Test if element with given xpath exists.
 boolean hasForm()
          Check whether the current page contains a form.
 boolean hasForm(java.lang.String nameOrID)
          Return true if the current page contains a specific form.
 boolean hasFormParameterNamed(java.lang.String paramName)
          Return true if a form input element is present on the current form.
 boolean hasFrame(java.lang.String frameNameOrId)
          Test if the given frame is present.
 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)
          Return true if a link is present in the current page containing the exact specified text.
 boolean hasLinkWithImage(java.lang.String imageFileName, int index)
          Return true if a link is present with a given image based on filename of image.
 boolean hasLinkWithText(java.lang.String linkText, int index)
          Return true if a link is present in the current response containing the specified text.
 boolean hasRadioOption(java.lang.String radioGroup, java.lang.String radioOptionValue)
          Checks 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(java.lang.String nameOrID)
          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(java.lang.String selectName, int index, java.lang.String optionLabel)
          Test if the Nth select box has the given option (by label).
 boolean hasSelectOption(java.lang.String selectName, java.lang.String optionLabel)
          Test if a select box has the given option (by label).
 boolean hasSelectOptionValue(java.lang.String selectName, int index, java.lang.String optionValue)
          Test if the Nth select box has the given option (by value).
 boolean hasSelectOptionValue(java.lang.String selectName, java.lang.String optionValue)
          Test if a select box has the given option (by value).
 boolean hasSubmitButton()
          Checks if the current form contains a submit button.
 boolean hasSubmitButton(java.lang.String nameOrID)
          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(java.lang.String nameOrID, java.lang.String value)
          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(java.lang.String tableSummaryNameOrId)
          Check if the Table object representing a specified table exists.
 boolean hasWindow(java.lang.String windowName)
          Test if the window with the given name is present.
 boolean hasWindowByTitle(java.lang.String windowTitle)
          Test if window with the given title is present.
 boolean isCheckboxSelected(java.lang.String checkBoxName)
          Determines if the checkbox is selected.
 boolean isCheckboxSelected(java.lang.String checkBoxName, java.lang.String checkBoxValue)
          Determines if the checkbox is selected.
 boolean isMatchInElement(java.lang.String elementID, java.lang.String regexp)
          Return true if a given regexp is contained within the specified element.
 boolean isTextInElement(java.lang.String elementID, java.lang.String text)
          Return true if a given string is contained within the specified element.
 void reset()
          Reset the current form with the default reset button.
 void selectOptions(java.lang.String selectName, int index, java.lang.String[] optionValues)
          Select option(s) of the Nth select box by value.
 void selectOptions(java.lang.String selectName, java.lang.String[] optionValues)
          Select option(s) of a select box by value.
 void setExpectedJavaScriptAlert(JavascriptAlert[] alerts)
          Tell the testing engine that the given alert boxes are expected in the given order.
 void setExpectedJavaScriptConfirm(JavascriptConfirm[] confirms)
          Tell the testing engine that the given confirm boxes are expected in the given order.
 void setExpectedJavaScriptPrompt(JavascriptPrompt[] prompts)
          Tell the testing engine that the given prompt boxes are expected in the given order.
 void setHiddenField(java.lang.String inputName, java.lang.String text)
          Fill hidden field with the provided text.
 void setIgnoreFailingStatusCodes(boolean ignore)
          Should the tester ignore failing status codes (300+)? Otherwise, failing status codes will throw an exception.
 void setScriptingEnabled(boolean value)
          Enable or disable Javascript support.
 void setTextField(java.lang.String inputName, java.lang.String text)
          Fill a text, password or textarea field with the provided text.
 void setThrowExceptionOnScriptError(boolean value)
          Set whether or not to throw an exception on Javascript errors.
 void setTimeout(int milliseconds)
          Set the timeout for the request.
 void setWorkingForm(int index)
          Set the form on the current page that the client wishes to work with explicitly by index in the page.
 void setWorkingForm(java.lang.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(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)
          Deselect a specified checkbox.
 void unselectOptions(java.lang.String selectName, int index, java.lang.String[] optionValues)
          Unselect option(s) of the Nth select box with the specified name by value.
 void unselectOptions(java.lang.String selectName, java.lang.String[] optionValues)
          Unselect option(s) of a select box by value.
 

Method Detail

beginAt

void beginAt(java.net.URL aInitialURL,
             TestContext aTestContext)
             throws TestingEngineResponseException
Open the browser at an initial URL.

Parameters:
aInitialURL - Initial URL
aTestContext - Test context
Throws:
TestingEngineResponseException - If something bad happend (404)

closeBrowser

void closeBrowser()
                  throws ExpectedJavascriptAlertException,
                         ExpectedJavascriptConfirmException,
                         ExpectedJavascriptPromptException
Close the browser and check if there is no pending Javascript alert, confirm or prompt.

Throws:
ExpectedJavascriptAlertException - If there is pending Javascript alert setExpectedJavaScriptAlert(JavascriptAlert[])
ExpectedJavascriptConfirmException - If there is pending Javascript confirm setExpectedJavaScriptConfirm(JavascriptConfirm[])
ExpectedJavascriptPromptException - If there is pending Javascript prompt setExpectedJavaScriptPrompt(JavascriptPrompt[])

gotoPage

void gotoPage(java.net.URL url)
              throws TestingEngineResponseException
Simulate user typing a new URL in the browser.

Parameters:
url - Full URL of the page.
Throws:
TestingEngineResponseException - If something bad happend (404)

setScriptingEnabled

void setScriptingEnabled(boolean value)
Enable or disable Javascript support.

Parameters:
value - true to enable Javascript.

setThrowExceptionOnScriptError

void setThrowExceptionOnScriptError(boolean value)
Set whether or not to throw an exception on Javascript errors.

Parameters:
value - true to throw an exception on Javascript errors.

getCookies

java.util.List<?> getCookies()
Get all cookies.

Returns:
List of javax.servlet.http.Cookie.

hasWindow

boolean hasWindow(java.lang.String windowName)
Test if the window with the given name is present.

Parameters:
windowName - Name of the window.
Returns:
true if the Window exists.

hasWindowByTitle

boolean hasWindowByTitle(java.lang.String windowTitle)
Test if window with the given title is present.

Parameters:
windowTitle - Title of the window.
Returns:
true if the Window exists.

gotoWindow

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

Parameters:
windowName - Name of the window

gotoWindowByTitle

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

Parameters:
title - Title of the window

gotoWindow

void gotoWindow(int windowID)
Goto window with the given Javascript ID.

Parameters:
windowID - Javascript ID of the window

gotoRootWindow

void gotoRootWindow()
Make the root window active.


getWindowCount

int getWindowCount()
Get the number of openend Windows.

Returns:
Number of openend Windows.

closeWindow

void closeWindow()
Close the current window.


hasFrame

boolean hasFrame(java.lang.String frameNameOrId)
Test if the given frame is present.

Parameters:
frameNameOrId - Name or ID of the frame. ID is checked first.
Returns:
true if the frame exists.

gotoFrame

void gotoFrame(java.lang.String frameNameOrId)
Make the frame with the given name or ID active in the current conversation.

Parameters:
frameNameOrId - Name or ID of the frame. ID is checked first.

setWorkingForm

void setWorkingForm(int index)
Set the form on the current page that the client wishes to work with explicitly by index in the page.

Parameters:
index - The 0-based index, when more than one form with the same name is expected.

setWorkingForm

void setWorkingForm(java.lang.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).

Parameters:
nameOrId - name or id of the form to be worked with.
index - The 0-based index, when more than one form with the same name is expected.

hasForm

boolean hasForm()
Check whether the current page contains a form.

Returns:
true if there is at least a form.

hasForm

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

Parameters:
nameOrID - name of id of the form to check for.
Returns:
true if there is at least a form.

hasFormParameterNamed

boolean hasFormParameterNamed(java.lang.String paramName)
Return true if a form input element is present on the current form.

Parameters:
paramName - name of the input element to check for
Returns:
true if there is at least a form parameter.

getTextFieldValue

java.lang.String getTextFieldValue(java.lang.String paramName)
Return the current value of a text field with name paramName. Text fields are input text, input password and textarea

Parameters:
paramName - name of the text field element.
Returns:
Text content of the text field.

getHiddenFieldValue

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

Parameters:
paramName - name of the hidden input element.
Returns:
Value of the hidden input.

setTextField

void setTextField(java.lang.String inputName,
                  java.lang.String text)
Fill a text, password or textarea field with the provided text.

Parameters:
inputName - name of the text, password or textarea element
text - value to type in the field.

setHiddenField

void setHiddenField(java.lang.String inputName,
                    java.lang.String text)
Fill hidden field with the provided text.

Parameters:
inputName - name of the hidden element
text - value to set in the hidden field.

getSelectOptionValues

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


Should return [Component_1_a, Component_1_b, Component_3, Component_4, Component_5]

Parameters:
selectName - name of the select box.
Returns:
Array of select options values.

getSelectOptionValues

java.lang.String[] getSelectOptionValues(java.lang.String selectName,
                                         int index)
Return a string array of option values for the Nth select box with the specified name.

Parameters:
selectName - name of the select box.
index - the 0-based index used when more than one select with the same name is expected.
Returns:
Array of select options values.

getSelectedOptions

java.lang.String[] getSelectedOptions(java.lang.String selectName)
Return the values of the currently selected items in a select box.

Parameters:
selectName - name of the select box.

getSelectedOptions

java.lang.String[] getSelectedOptions(java.lang.String selectName,
                                      int index)
Return the values of the currently selected items in the Nth select box with the provided name.

Parameters:
selectName - name of the select box.
index - the 0-based index used when more than one select with the same name is expected.

getSelectOptionLabelForValue

java.lang.String getSelectOptionLabelForValue(java.lang.String selectName,
                                              java.lang.String optionValue)
Get the label for a given option of a select box.

Parameters:
selectName - name of the select box.
optionValue - label of the option.

getSelectOptionLabelForValue

java.lang.String getSelectOptionLabelForValue(java.lang.String selectName,
                                              int index,
                                              java.lang.String optionValue)
Get the label for a given option of the Nth select box with the specified name.

Parameters:
selectName - name of the select box.
index - the 0-based index used when more than one select with the same name is expected.
optionValue - label of the option.

getSelectOptionValueForLabel

java.lang.String getSelectOptionValueForLabel(java.lang.String selectName,
                                              java.lang.String optionLabel)
Get the value for a given option of a select box.

Parameters:
selectName - name of the select box.
optionLabel - label of the option.

getSelectOptionValueForLabel

java.lang.String getSelectOptionValueForLabel(java.lang.String selectName,
                                              int index,
                                              java.lang.String optionLabel)
Get the value for a given option of the Nth select box with the specified name.

Parameters:
selectName - name of the select box.
index - the 0-based index used when more than one select with the same name is expected.
optionLabel - label of the option.

selectOptions

void selectOptions(java.lang.String selectName,
                   java.lang.String[] optionValues)
Select option(s) of a select box by value.

Parameters:
selectName - name of the select box.
optionValues - values of the options to select.

selectOptions

void selectOptions(java.lang.String selectName,
                   int index,
                   java.lang.String[] optionValues)
Select option(s) of the Nth select box by value.

Parameters:
selectName - name of the select box.
index - the 0-based index of the select element when multiple select elements are expected.
optionValues - values of the options to select.

unselectOptions

void unselectOptions(java.lang.String selectName,
                     java.lang.String[] optionValues)
Unselect option(s) of a select box by value.

Parameters:
selectName - name of the select box.
optionValues - vaules of the options to unselect.

unselectOptions

void unselectOptions(java.lang.String selectName,
                     int index,
                     java.lang.String[] optionValues)
Unselect option(s) of the Nth select box with the specified name by value.

Parameters:
selectName - name of the select box.
index - the 0-based index of the select element when multiple select elements are expected.
optionValues - vaules of the options to unselect.

hasSelectOption

boolean hasSelectOption(java.lang.String selectName,
                        java.lang.String optionLabel)
Test if a select box has the given option (by label).

Parameters:
selectName - name of the select box.
optionLabel - label of the option.
Returns:
true if a select box has the given option (by label).

hasSelectOptionValue

boolean hasSelectOptionValue(java.lang.String selectName,
                             java.lang.String optionValue)
Test if a select box has the given option (by value).

Parameters:
selectName - name of the select box.
optionValue - value of the option.
Returns:
true if a select box has the given option (by value).

hasSelectOption

boolean hasSelectOption(java.lang.String selectName,
                        int index,
                        java.lang.String optionLabel)
Test if the Nth select box has the given option (by label).

Parameters:
selectName - name of the select box.
index - the 0-based index of the select element when multiple select elements are expected.
optionLabel - label of the option.
Returns:
true if a select box has the given option (by label).

hasSelectOptionValue

boolean hasSelectOptionValue(java.lang.String selectName,
                             int index,
                             java.lang.String optionValue)
Test if the Nth select box has the given option (by value).

Parameters:
selectName - name of the select box.
index - the 0-based index of the select element when multiple select elements are expected.
optionValue - value of the option.
Returns:
true if a select box has the given option (by value).

isCheckboxSelected

boolean isCheckboxSelected(java.lang.String checkBoxName)
Determines if the checkbox is selected.

Parameters:
checkBoxName - name of the checkbox.
Returns:
true if the first checkbox with given name is selected.

isCheckboxSelected

boolean isCheckboxSelected(java.lang.String checkBoxName,
                           java.lang.String checkBoxValue)
Determines if the checkbox is selected.

Parameters:
checkBoxName - name attribut of the checkbox.
checkBoxValue - value attribut of the checkbox.
Returns:
true if the first checkbox with given name and value is selected.

checkCheckbox

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

Parameters:
checkBoxName - name of checkbox to be selected.

checkCheckbox

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

Parameters:
checkBoxName - name of checkbox to be selected.
checkBoxValue - value of the checkbox (to differenciate checkboxes with the same name).

uncheckCheckbox

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

Parameters:
checkBoxName - name of checkbox to be deselected.

uncheckCheckbox

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

Parameters:
checkBoxName - name of checkbox to be deselected.
value - value of the checkbox (to differenciate checkboxes with the same name).

clickRadioOption

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

Parameters:
radioGroup - name of the radio group.
radioOptionValue - value of the option to check for.

hasRadioOption

boolean hasRadioOption(java.lang.String radioGroup,
                       java.lang.String radioOptionValue)
Checks if a radio group contains the indicated option.

Parameters:
radioGroup - name of the radio group.
radioOptionValue - value of the option to check for.

getSelectedRadio

java.lang.String getSelectedRadio(java.lang.String radioGroup)
Return the currently selected radio button.

Parameters:
radioGroup - name of the radio group.
Returns:
value of the selected radio.

hasSubmitButton

boolean hasSubmitButton()
Checks if the current form contains a submit button.


hasSubmitButton

boolean hasSubmitButton(java.lang.String nameOrID)
Checks if the current form contains a specific submit button.
A submit button can be the following HTML elements:

Parameters:
nameOrID - name or id of the button to check for.

hasSubmitButton

boolean hasSubmitButton(java.lang.String nameOrID,
                        java.lang.String value)
Checks if the current form contains a specific submit button.
A submit button can be the following HTML elements:

Parameters:
nameOrID - name of id of the button to check for.
value - value of the button

submit

void submit()
Submit the current form with the default submit button. See #getFormfor an explanation of how the current form is established.
A submit button can be the following HTML elements:


submit

void submit(java.lang.String buttonName)
Submit the current form with the specifed submit button. See #getFormfor an explanation of how the current form is established.
A submit button can be the following HTML elements:

Parameters:
buttonName - name of the button to use for submission.

submit

void submit(java.lang.String buttonName,
            java.lang.String buttonValue)
Submit the current form with the specifed submit button (by name and value). See #getFormfor an explanation of how the current form is established.
A submit button can be the following HTML elements:

Parameters:
buttonName - name of the button to use for submission.
buttonValue - value/label of the button to use for submission

hasResetButton

boolean hasResetButton()
Checks if the current form contains a reset button.
A reset button can be the following HTML elements:


hasResetButton

boolean hasResetButton(java.lang.String nameOrID)
Checks if the current form contains a specific reset button.
A reset button can be the following HTML elements:

Parameters:
nameOrID - name or id of the button to check for.

reset

void reset()
Reset the current form with the default reset button. See #getFormfor an explanation of how the current form is established.
A reset button can be the following HTML elements:


hasButtonWithText

boolean hasButtonWithText(java.lang.String text)
Checks if a button with text is present.
A button can be the following HTML elements:

Parameters:
text - the text of the button (contents of the value attribute).
Returns:
true when the button with text could be found.

hasButton

boolean hasButton(java.lang.String buttonId)
Checks if a button with id is present.
A button can be the following HTML elements:

Parameters:
buttonId - the ID of the button.
Returns:
true when the button with text could be found.

clickButton

void clickButton(java.lang.String buttonId)
Click the indicated button.
A button can be the following HTML elements:

Parameters:
buttonId - the ID of the button.

clickButtonWithText

void clickButtonWithText(java.lang.String buttonValueText)
Clicks a button with text of the value attribute.
A button can be the following HTML elements:

Parameters:
buttonValueText - the text of the button (contents of the value attribute).

getPageURL

java.net.URL getPageURL()
Get the location of the current page.

Returns:
an URL.

getPageText

java.lang.String getPageText()
Return the string representation of the current page, encoded as specified by the current TestContext.

Returns:
Visible text in the page.

getPageSource

java.lang.String getPageSource()
Return the source of the current page (like in a browser).

Returns:
Source of the page (or HTTP Body as String)

getPageTitle

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

Returns:
Title of the page.

getServerResponse

java.lang.String getServerResponse()
Return the response of the server for the current page.

Returns:
HTTP header & body

getInputStream

java.io.InputStream getInputStream()
Gets the last server response as input stream.


getInputStream

java.io.InputStream getInputStream(java.net.URL url)
                                   throws TestingEngineResponseException
Gets the input stream for a given URL - can be used to test images or other resources without changing the current navigation context.

Parameters:
url - the url to the resource
Throws:
TestingEngineResponseException

hasTable

boolean hasTable(java.lang.String tableSummaryNameOrId)
Check if the Table object representing a specified table exists.

Parameters:
tableSummaryNameOrId - summary, name or id of the table.
Returns:
true if table exists.

getTable

Table getTable(java.lang.String tableSummaryNameOrId)
Each framework have it's own way to represent a Table. Testing engines are responsible for converting to the unified JWebUnit format.

Parameters:
tableSummaryNameOrId - summary, name or id of the table to return.
Returns:
unified JWebUnit representation of a table.

hasLinkWithText

boolean hasLinkWithText(java.lang.String linkText,
                        int index)
Return true if a link is present in the current response containing the specified text.

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

boolean hasLinkWithExactText(java.lang.String linkText,
                             int index)
Return true if a link is present in the current page containing the exact specified text. Note. This will call String.trim() to trim all leading / trailing spaces. RFE 996031...

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.

hasLinkWithImage

boolean hasLinkWithImage(java.lang.String imageFileName,
                         int index)
Return true if a link is present with a given image based on filename of image.

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".
index - The 0-based index, when more than one link with the same text is expected.

hasLink

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

Parameters:
anId - link id to check for.

clickLinkWithText

void clickLinkWithText(java.lang.String linkText,
                       int index)
Navigate by submitting a request based on a link containing the specified text. A RuntimeException is thrown if no such link can be found.

Parameters:
linkText - text which link to be navigated should contain.
index - The 0-based index, when more than one link with the same text is expected.

clickLinkWithExactText

void clickLinkWithExactText(java.lang.String linkText,
                            int index)
Navigate by clicking a link with the exact specified text. A RuntimeException is thrown if no such link can be found.

Parameters:
linkText - exact text which link to be navigated should contain.
index - The 0-based index, when more than one link with the same text is expected.

clickLink

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.

Parameters:
anID - id of link to be navigated.

clickLinkWithImage

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.

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".
index - The 0-based index, when more than one link with the same text is expected.

hasElement

boolean hasElement(java.lang.String anID)
Test if element with given id exists.

Parameters:
anID - id of the element.
Returns:
true if element was found.

hasElementByXPath

boolean hasElementByXPath(java.lang.String xpath)
Test if element with given xpath exists.

Parameters:
xpath - xpath of the element.
Returns:
true if element was found.

clickElementByXPath

void clickElementByXPath(java.lang.String xpath)
Click element with given xpath.

Parameters:
xpath - xpath of the element.

getElementAttributByXPath

java.lang.String getElementAttributByXPath(java.lang.String xpath,
                                           java.lang.String attribut)
Get attribut value of the given element. For example, if you have img src="bla.gif" alt="toto", getElementAttributByXPath("//img[@src='bla.gif']", "alt") returns "toto"

Parameters:
xpath - xpath of the element.
attribut - name of the attribut.
Returns:
Attribut value or null if the element is not found.

getElementTextByXPath

java.lang.String getElementTextByXPath(java.lang.String xpath)
Get text of the given element.

Parameters:
xpath - xpath of the element.

isTextInElement

boolean isTextInElement(java.lang.String elementID,
                        java.lang.String text)
Return true if a given string is contained within the specified element.

Parameters:
elementID - ID of element to inspect.
text - text to check for.
Returns:
true if text was found.

isMatchInElement

boolean isMatchInElement(java.lang.String elementID,
                         java.lang.String regexp)
Return true if a given regexp is contained within the specified element.

Parameters:
elementID - Id of element to inspect.
regexp - regexp to match.
Returns:
true if a match is found.

setExpectedJavaScriptAlert

void setExpectedJavaScriptAlert(JavascriptAlert[] alerts)
                                throws ExpectedJavascriptAlertException
Tell the testing engine that the given alert boxes are expected in the given order.

Parameters:
alerts - Expected alerts.
Throws:
ExpectedJavascriptAlertException - If there are still unconsummed alert since a previous call of this method.

setExpectedJavaScriptConfirm

void setExpectedJavaScriptConfirm(JavascriptConfirm[] confirms)
                                  throws ExpectedJavascriptConfirmException
Tell the testing engine that the given confirm boxes are expected in the given order.

Parameters:
confirms - Expected confirms.
Throws:
ExpectedJavascriptConfirmException - If there are still unconsummed confirm since a previous call of this method.

setExpectedJavaScriptPrompt

void setExpectedJavaScriptPrompt(JavascriptPrompt[] prompts)
                                 throws ExpectedJavascriptPromptException
Tell the testing engine that the given prompt boxes are expected in the given order.

Parameters:
prompts - Expected prompts.
Throws:
ExpectedJavascriptPromptException - If there are still unconsummed prompt since a previous call of this method.

getElementByXPath

IElement getElementByXPath(java.lang.String xpath)
Get an element wrapper for a given xpath.

Parameters:
xpath - XPath to evaluate
Returns:
The element if found
See Also:
getElementsByXPath(String)

getElementByID

IElement getElementByID(java.lang.String id)
Get an element wrapper for a given ID.

Parameters:
id - element ID to find
Returns:
The element if found

getElementsByXPath

java.util.List<IElement> getElementsByXPath(java.lang.String xpath)
Get a list of all elements that match the given xpath.

Parameters:
xpath - XPath to evaluate
Returns:
List of all elements found
See Also:
getElementByXPath(String)

getServerResponseCode

int getServerResponseCode()
Get the request response code.

Returns:
The request response code.

getHeader

java.lang.String getHeader(java.lang.String name)
Get a particular header or null.

Parameters:
name - The header name
Returns:
The first header value or null

getAllHeaders

java.util.Map<java.lang.String,java.lang.String> getAllHeaders()
Get all headers.

Returns:
The header values stored in a map.

setIgnoreFailingStatusCodes

void setIgnoreFailingStatusCodes(boolean ignore)
Should the tester ignore failing status codes (300+)? Otherwise, failing status codes will throw an exception.

Parameters:
ignore -

getComments

java.util.List<java.lang.String> getComments()
Get all the comments in a document, as a list of strings.


setTimeout

void setTimeout(int milliseconds)
Set the timeout for the request. A timeout of 0 means an infinite timeout.

Parameters:
milliseconds - the milliseconds in which to timeout, or 0 for infinite wait (the default).


Copyright © 2002-2011 SourceForge. All Rights Reserved.