| 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.commons.jelly.TagSupport
net.sf.jameleon.LocationAwareTagSupport
net.sf.jameleon.JameleonTagSupport
net.sf.jameleon.function.FunctionTag
net.sf.jameleon.plugin.htmlunit.HtmlUnitFunctionTag
public abstract class HtmlUnitFunctionTag
| Field Summary | |
|---|---|
protected  HtmlUnitHelper | 
helper
 | 
protected  HtmlUnitSessionTag | 
sessionTag
 | 
protected  HtmlForm | 
workingForm
 | 
| Fields inherited from class net.sf.jameleon.function.FunctionTag | 
|---|
addt, breakPoint, expectException, expectFailure, fResults, functionDelay, functionId, lastFileWritten, log, NO_DELAY, params, postcondition, precondition, st, state, tct, vpt | 
| Fields inherited from class net.sf.jameleon.JameleonTagSupport | 
|---|
attributes, broker, contextVars, fp, unsupportedAttributes | 
| Fields inherited from class net.sf.jameleon.LocationAwareTagSupport | 
|---|
columnNumber, elementTagName, lineNumber, scriptFileName | 
| Fields inherited from class org.apache.commons.jelly.TagSupport | 
|---|
body, context, hasTrimmed, parent, shouldTrim | 
| Constructor Summary | |
|---|---|
HtmlUnitFunctionTag()
 | 
|
| Method Summary | |
|---|---|
 void | 
assertTextPresent(String expectedText)
Validates that the provided text exists on the page.  | 
 void | 
assertTextPresent(String expectedText,
                  int assertLevel)
Validates that the title of the current html page matches the expected title  | 
 void | 
assertTextPresent(String msg,
                  String expectedText)
Validates that the title of the current html page matches the expected title If the test fails display the given message | 
 void | 
assertTextPresent(String msg,
                  String expectedText,
                  int assertLevel)
Validates that the title of the current html page matches the expected title If the test fails display the given message | 
 void | 
assertTitleEquals(String expectedTitle)
Validates that the title of the current html page matches the expected title  | 
 void | 
assertTitleEquals(String expectedTitle,
                  int assertLevel)
Validates that the title of the current html page matches the expected title  | 
 void | 
assertTitleEquals(String msg,
                  String expectedTitle)
Validates that the title of the current html page matches the expected title If the test fails display the given message | 
 void | 
assertTitleEquals(String msg,
                  String expectedTitle,
                  int assertLevel)
Validates that the title of the current html page matches the expected title If the test fails display the given message | 
 void | 
assertXPathMatches(String xpath)
Validates that the provided xpath matches against the currently active page  | 
 void | 
assertXPathMatches(String xpath,
                   int assertLevel)
Validates that the provided xpath matches against the currently active page  | 
 void | 
assertXPathMatches(String msg,
                   String xpath)
Validates that the provided xpath matches against the currently active page If the test fails display the given message | 
 void | 
assertXPathMatches(String msg,
                   String xpath,
                   int assertLevel)
Validates that the provided xpath matches against the currently active page If the test fails display the given message | 
 void | 
clickElementWithXPath(String xpath)
Clicks on the HTML element matching the provided XPath  | 
 HtmlElement | 
getHtmlElementByAttributeNameAndValue(String tagname,
                                      String attributeName,
                                      String attributeValue)
Gets an HTMLElement by the tag name, attribute name and the attribute value.  | 
 HtmlElement | 
getHtmlElementByXPath(String xpath)
Gets an HtmlElement matching the provided xpath expression  | 
 HtmlForm | 
getHtmlForm(String idNameIndexOrXpath)
This is a power method to get a form element by the following order.  | 
 HtmlForm | 
getHtmlFormById(String attributeValue)
Gets a form element back by its id attribute.  | 
 HtmlForm | 
getHtmlFormByIndex(int index)
Gets a form element back by its index or location on the page.  | 
 HtmlForm | 
getHtmlFormByName(String attributeValue)
Gets a form element back by its name attribute.  | 
 HtmlForm | 
getHtmlFormByXPath(String xpath)
Gets a form element back by an XPath expression  | 
 HtmlForm | 
getWorkingForm()
Gets the current working form or null if one hasn't been set.  | 
 void | 
navigate(String url)
Navigates to the provided URL  | 
 void | 
setCheckBox(String fieldName,
            boolean checked)
Checks or unchecks the checkbox that either exists in the workingForm or in the current page  | 
 void | 
setCheckBox(String fieldName,
            String fieldValue,
            boolean checked)
Checks or unchecks the checkbox that either exists in the workingForm or in the current page  | 
 void | 
setFileField(String fieldName,
             String value)
Sets the file field that either exists in the workingForm or in the current page  | 
 void | 
setHiddenField(String fieldName,
               String value)
Sets the hidden field that either exists in the workingForm or in the current page  | 
 void | 
setHtmlInputValue(HtmlInput input,
                  String value,
                  String type)
Sets an input field type's value  | 
 void | 
setHtmlInputValueByXPath(String xpath,
                         String value,
                         String type)
Sets an input field type's value  | 
 void | 
setPasswordField(String fieldName,
                 String value)
Sets the password field that either exists in the workingForm or in the current page  | 
 void | 
setRadioButton(String fieldName,
               String fieldValue,
               boolean checked)
Checks or unchecks the radio button that either exists in the workingForm or in the current page.  | 
 void | 
setSelectFieldByIndex(String fieldName,
                      int index,
                      boolean selected)
Selects or unselects the option by its index order that either exists in the workingForm or in the current page.  | 
 void | 
setSelectFieldByOptionText(String fieldName,
                           String optionText,
                           boolean selected)
Selects or unselects the option with the displayed text that either exists in the workingForm or in the current page.  | 
 void | 
setSelectFieldByValue(String fieldName,
                      String valueAttribute,
                      boolean selected)
Selects or unselects the option with the given attribute value that either exists in the workingForm or in the current page.  | 
 void | 
setSelectFieldByXPath(String xpath,
                      boolean selected)
Selects or unselects the option defined by XPath.  | 
 void | 
setTextArea(String fieldName,
            String value)
Sets the text area that either exists in the workingForm or in the current page  | 
 void | 
setTextField(String fieldName,
             String value)
Sets the text field that either exists in the workingForm or in the current page  | 
 void | 
setupEnvironment()
Gets the references of the session and the test results from the parent TestCase This method gets called once all attributes are set from the macro language.  | 
 void | 
setWorkingForm(String idNameIndexOrXpath)
Sets the working form to form with the given id This is a power method to set a form element by the following order.  | 
 void | 
setWorkingFormById(String id)
Sets the working form to form with the given id  | 
 void | 
setWorkingFormByIndex(int index)
Sets the working form to nth form on the current page.  | 
 void | 
setWorkingFormByName(String name)
Sets the working form to nth form on the current page.  | 
 void | 
setWorkingFormByXPath(String xpath)
Sets the working form by the matching XPath expression  | 
 void | 
store(String fName,
      int event)
 | 
| Methods inherited from class net.sf.jameleon.JameleonTagSupport | 
|---|
cleanVariablesInContext, createAttributes, describeAttributes, getAttributeBroker, getAttributes, getAttributeType, getClassAttributes, getFunctionalPoint, getUnsupportedAttributes, loadFunctionalPoint, resetFunctionalPoint, setAttribute, setVariableInContext, testForUnsupportedAttributesCaught | 
| Methods inherited from class net.sf.jameleon.LocationAwareTagSupport | 
|---|
getColumnNumber, getElementName, getFileName, getLineNumber, setColumnNumber, setElementName, setFileName, setLineNumber | 
| Methods inherited from class org.apache.commons.jelly.TagSupport | 
|---|
findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, getBody, getBodyText, getBodyText, getContext, getParent, invokeBody, isEscapeText, isTrim, setBody, setContext, setEscapeText, setParent, setTrim, trimBody | 
| Methods inherited from class java.lang.Object | 
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Methods inherited from interface org.apache.commons.jelly.Tag | 
|---|
getBody, getContext, getParent, invokeBody, setBody, setContext, setParent | 
| Field Detail | 
|---|
protected HtmlUnitHelper helper
protected HtmlUnitSessionTag sessionTag
protected HtmlForm workingForm
| Constructor Detail | 
|---|
public HtmlUnitFunctionTag()
| Method Detail | 
|---|
public void navigate(String url)
url - - the url to navigate to.public void setupEnvironment()
setupEnvironment in class FunctionTag
public void store(String fName,
                  int event)
           throws IOException
store in interface Storablestore in class FunctionTagIOExceptionpublic void assertTextPresent(String expectedText)
expectedText - expected text
public void assertTextPresent(String msg,
                              String expectedText)
message
msg - - The message to display if text is not in the response.expectedText - expected text
public void assertTextPresent(String expectedText,
                              int assertLevel)
expectedText - expected textassertLevel - - Only run this test under the assertLevel as described in AssertLevel
public void assertTextPresent(String msg,
                              String expectedText,
                              int assertLevel)
message
msg - - The message to display if text is not in the response.expectedText - expected textassertLevel - - Only run this test under the assertLevel as described in AssertLevelpublic void assertTitleEquals(String expectedTitle)
expectedTitle - expected title value
public void assertTitleEquals(String msg,
                              String expectedTitle)
message
msg - - The message to display if text is not in the response.expectedTitle - expected title value
public void assertTitleEquals(String expectedTitle,
                              int assertLevel)
expectedTitle - expected title valueassertLevel - - Only run this test under the assertLevel as described in AssertLevel
public void assertTitleEquals(String msg,
                              String expectedTitle,
                              int assertLevel)
message
msg - - The message to display if text is not in the response.expectedTitle - expected title valueassertLevel - - Only run this test under the assertLevel as described in AssertLevelpublic void assertXPathMatches(String xpath)
xpath - The XPath to match
public void assertXPathMatches(String msg,
                               String xpath)
message
msg - - The message to display if text is not in the response.xpath - The XPath to match
public void assertXPathMatches(String xpath,
                               int assertLevel)
xpath - The XPath to matchassertLevel - - Only run this test under the assertLevel as described in AssertLevel
public void assertXPathMatches(String msg,
                               String xpath,
                               int assertLevel)
message
msg - - The message to display if text is not in the response.xpath - The XPath to matchassertLevel - - Only run this test under the assertLevel as described in AssertLevelpublic void clickElementWithXPath(String xpath)
xpath - - the XPath expression that defines the HTML element to click.public HtmlForm getHtmlForm(String idNameIndexOrXpath)
idNameIndexOrXpath - - The id, name, index or XPath expression defining the location of the form
public HtmlForm getHtmlFormById(String attributeValue)
attributeValue - - the value of the id attribute.
public HtmlForm getHtmlFormByIndex(int index)
index - - the nth form on the page
public HtmlForm getHtmlFormByName(String attributeValue)
attributeValue - - the value of the name attribute.
public HtmlForm getHtmlFormByXPath(String xpath)
xpath - - The XPath expression matching the desired form
public HtmlElement getHtmlElementByXPath(String xpath)
xpath - - An XPath expression that matches the desired HtmlElement
public HtmlElement getHtmlElementByAttributeNameAndValue(String tagname,
                                                         String attributeName,
                                                         String attributeValue)
tagname - - The name of the tag to get back. In the above example, the value would be 'form'attributeName - - The name of attribute to check against. In the above example, the value would be 'id'attributeValue - - The value of the attribute to check against. In the above example, the value would be 'ten'
public HtmlForm getWorkingForm()
public void setCheckBox(String fieldName,
                        boolean checked)
fieldName - - The name of the checkbox to checkchecked - - set to true to check the checkbox and to false to uncheck it
public void setCheckBox(String fieldName,
                        String fieldValue,
                        boolean checked)
fieldName - - The name of the checkbox to checkfieldValue - - The value of the checkbox to checkchecked - - set to true to check the checkbox and to false to uncheck it
public void setFileField(String fieldName,
                         String value)
fieldName - - The name of the input field to set the value ofvalue - - The value to set the input field to
public void setHiddenField(String fieldName,
                           String value)
fieldName - - The name of the input field to set the value ofvalue - - The value to set the input field to
public void setPasswordField(String fieldName,
                             String value)
fieldName - - The name of the input field to set the value ofvalue - - The value to set the input field to
public void setRadioButton(String fieldName,
                           String fieldValue,
                           boolean checked)
fieldName - - The name of the radio button to checkfieldValue - - The value of the radio button to checkchecked - - set to true to check the radio button and to false to uncheck it
public void setSelectFieldByIndex(String fieldName,
                                  int index,
                                  boolean selected)
fieldName - - The name of the select field to selectindex - - The nth option in the list. 1st option = 0selected - - set to true to select and to false to unselect it
public void setSelectFieldByOptionText(String fieldName,
                                       String optionText,
                                       boolean selected)
fieldName - - The name of the select field to selectoptionText - - The text displayed in the drop-downselected - - set to true to select and to false to unselect it
public void setSelectFieldByValue(String fieldName,
                                  String valueAttribute,
                                  boolean selected)
fieldName - - The name of the select field to selectvalueAttribute - - The value of option field to selectselected - - set to true to select and to false to unselect it
public void setSelectFieldByXPath(String xpath,
                                  boolean selected)
xpath - - The XPath expression that matches an HtmlOption (not a select) to be selectedselected - - set to true to select and to false to unselect it
public void setTextArea(String fieldName,
                        String value)
fieldName - - The name of the input field to set the value ofvalue - - The value to set the input field to
public void setTextField(String fieldName,
                         String value)
fieldName - - The name of the input field to set the value ofvalue - - The value to set the input field to
public void setHtmlInputValue(HtmlInput input,
                              String value,
                              String type)
input - - The HtmlInput to set the value onvalue - - The value to set the input element to.type - - The input type. If this does not match the given field, then this method will fail
public void setHtmlInputValueByXPath(String xpath,
                                     String value,
                                     String type)
xpath - - An XPath expression that matches the desired HtmlInput Element.value - - The value to set the input element to.type - - The input type. If this does not match the given field, then this method will failpublic void setWorkingForm(String idNameIndexOrXpath)
idNameIndexOrXpath - - The id, name, index or XPath expression defining the location of the formpublic void setWorkingFormById(String id)
id - - The value of the form's HTML id attributepublic void setWorkingFormByIndex(int index)
index - - The number of form on the page. The first form would be 1public void setWorkingFormByName(String name)
name - - The value of the name attribute in the formpublic void setWorkingFormByXPath(String xpath)
xpath - - The XPath expression that matches the form to use
  | 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||