Available Tags

This is a list of available tags for HtmlUnit Plug-in. This list of tags is also available in the Jameleon GUI. You can get there by selecting the "Functional Points" tab on the lower-left. All tags, including custom tags and other enabled plug-ins' tags, show up in the GUI.

HtmlUnit Plug-in Tags

TagShort Description
<htmlunit-click/>A tag which clicks on an HTML element.
<htmlunit-navigate/>A generic navigation tag used to make an HTTP GET request.
<htmlunit-record-alerts/>A tag that starts recording alert messages and stores them in the context.
<htmlunit-session/>A Session tag for the HtmlUnit plug-in.
<htmlunit-set-checkbox/>This tag is used to set or unset checkboxes defined by a given XPath expression.
<htmlunit-set-file-field/>A tag which sets a file field to the provided value.
<htmlunit-set-hidden-field/>A tag which sets a hidden field to the provided value.
<htmlunit-set-password-field/>A tag which sets a password field to the provided value.
<htmlunit-set-radio-button/>This tag is used to set or unset checkboxes defined by a given XPath expression.
<htmlunit-set-select-field/>This tag is used to select or unselect options in a select field.
<htmlunit-set-text-area/>A tag which sets a text area to the provided value.
<htmlunit-set-text-field/>A tag which sets a text field to the provided value.
<htmlunit-validate/>A generic validate tag used to validate HTML.

htmlunit-click

A tag which clicks on an HTML element.

To use XPath to click on a link defined as <a href="/some/url/index.html">some link</a>:

    
<htmlunit-click
functionId="Click on a the 'some link' link"
xpath="//a[text()='some link']"/>
To use XPath to click on a 'Search' button in the 3rd form:
    
<htmlunit-click
functionId="Click on a the 'some link' link"
xpath="//form[2]/input[@type='submit' and value='Search']"/>

Take a look at this tag's API docs and source code for more information.

Attribute NameContext NameDescriptionDefaultRequiredType
xpath

The xpath to locate the element to click on

falsejava.lang.String
functionId

The id of this function. This is used in the macro as a short description of the function

truejava.lang.String
breakPoint

Tells the GUI to stop at this functional point

falseboolean
precondition

Specifies this is a precondition

falseboolean
postcondition

Specifies this is a postcondition and will therefore get executed even if a previous functional point or session tag failed.

falseboolean
expectFailure

Specifies a failure is expected.

falseboolean
expectException

Specifies an exception is expected.

falseboolean
functionDelay

The delay time to use at the end of each functional point

-1falselong

htmlunit-navigate

A generic navigation tag used to make an HTTP GET request. To navigate to http://jameleon.sourceforge.net/index.html:

    
<htmlunit-navigate
functionId="Go to Jameleon's home page"
url="http://jameleon.sourceforge.net"/>

Take a look at this tag's API docs and source code for more information.

Attribute NameContext NameDescriptionDefaultRequiredType
url

The complete URL to navigate to

truejava.lang.String
functionId

The id of this function. This is used in the macro as a short description of the function

truejava.lang.String
breakPoint

Tells the GUI to stop at this functional point

falseboolean
precondition

Specifies this is a precondition

falseboolean
postcondition

Specifies this is a postcondition and will therefore get executed even if a previous functional point or session tag failed.

falseboolean
expectFailure

Specifies a failure is expected.

falseboolean
expectException

Specifies an exception is expected.

falseboolean
functionDelay

The delay time to use at the end of each functional point

-1falselong

htmlunit-record-alerts

A tag that starts recording alert messages and stores them in the context. If the alerts are already being recorded, then the existing alerts will be cleared and the recording will start over again.

To start recording alert boxes:

    
<htmlunit-record-alerts
functionId="Start recording alerts"
alertsContextName="alerts"/>
...
<ju-assert-equals
functionId="verify the # of alerts"
expected="3"
actual="${alerts.size()}"
/>
<ju-assert-equals
functionId="verify the 1st alert message"
expected="First Name is required"
actual="${alerts.get(0)}"
/>

Take a look at this tag's API docs and source code for more information.

Attribute NameContext NameDescriptionDefaultRequiredType
alertsContextName

The name of the context variable to store the list of collections in.

truejava.lang.String
functionId

The id of this function. This is used in the macro as a short description of the function

truejava.lang.String
breakPoint

Tells the GUI to stop at this functional point

falseboolean
precondition

Specifies this is a precondition

falseboolean
postcondition

Specifies this is a postcondition and will therefore get executed even if a previous functional point or session tag failed.

falseboolean
expectFailure

Specifies a failure is expected.

falseboolean
expectException

Specifies an exception is expected.

falseboolean
functionDelay

The delay time to use at the end of each functional point

-1falselong

htmlunit-session

A Session tag for the HtmlUnit plug-in. An example of its use might:

    
<testcase xmlns="jelly:jameleon">
<htmlunit-session baseUrl="http://www.google.com" beginSession="true">
<htmlunit-validate
functionId="Check that title is Google."
title="Google"/>
</htmlunit-session>
</testcase>

Take a look at this tag's API docs and source code for more information.

Attribute NameContext NameDescriptionDefaultRequiredType
enableSslCertCheckhtmlUnitEnableSslCertCheck

Enable or disable validity checking of SSL certificates. If "false", invalid SSL certs will be accepted. If not set, the default is "true".

falsejava.lang.Boolean
baseUrlbaseUrl

The url to use when starting the browser. This can be the entire URL including the path or not, but it must start with the protocol (e.g. http://some.domain.com)

falsejava.lang.String
beginAtbeginAt

If set, this would be the path after the protocol and/or domain. (e.g. /some/path/to/a/file.html)

falsejava.lang.String
enableSslCertCheckPorthtmlUnitEnableSslCertCheckPort

The port to use to connect to https. Usually leaving it as the default should do.

443falsejava.lang.Integer
application

The name of the application being run according to the *-TestCaseTag.properties file

falsejava.lang.String
organization

The organization (affiliate or company name) this application will be tested against.

falsejava.lang.String
postcondition

falseboolean
sessionDelay

Sets the tag to delay x milliseconds before anything else is executed.

0falselong
beginSession

Starts the applicattion and gets it to the state defined in the $testEnviroment-Applications.properties. DEFAULTS to false

falseboolean

htmlunit-set-checkbox

This tag is used to set or unset checkboxes defined by a given XPath expression.

To use XPath to check a checkbox named cb_1 that exists in a form with the name testform:

    
<htmlunit-set-checkbox
functionId="Check the checkbox named cb_1 field"
xpath="//form[@name='testform']/input[@name='cb_1']"
checked="true"/>

To use XPath to uncheck a checkbox named cb_1 that exists in a form with the name testform:

    
<htmlunit-set-checkbox
functionId="Uncheck the checkbox named cb_1 field"
xpath="//form[@name='testform']/input[@name='cb_1']"
checked="false"/>

To use the form and the field name to check a checkbox named cb_1 that exists in a form with the name testform:

    
<htmlunit-set-checkbox
functionId="Check the checkbox named cb_1 field"
form="testform"
fieldName="cb_1"
checked="true"/>

Take a look at this tag's API docs and source code for more information.

Attribute NameContext NameDescriptionDefaultRequiredType
checked

To check/uncheck the given checkbox.

falsejava.lang.Boolean
form

The identifier of the form. Value indentifiers are, the name, id, index or XPath expression Only the form or xpath attribute can be set at once

falsejava.lang.String
fieldName

The field name in the form.

falsejava.lang.String
value

The value to set the text field to

falsejava.lang.String
xpath

The xpath that matches the desired text field

falsejava.lang.String
functionId

The id of this function. This is used in the macro as a short description of the function

truejava.lang.String
breakPoint

Tells the GUI to stop at this functional point

falseboolean
precondition

Specifies this is a precondition

falseboolean
postcondition

Specifies this is a postcondition and will therefore get executed even if a previous functional point or session tag failed.

falseboolean
expectFailure

Specifies a failure is expected.

falseboolean
expectException

Specifies an exception is expected.

falseboolean
functionDelay

The delay time to use at the end of each functional point

-1falselong

htmlunit-set-file-field

A tag which sets a file field to the provided value.

To use XPath to set a file field named testFileField that exists in a form with the id testform:

    
<htmlunit-set-file-field
functionId="Set the testFileField field to '/tmp/files/my_file.tar.gz'"
xpath="//form[@id='testform']/input[@name='testFileField']"
value="/tmp/files/my_file.tar.gz"/>
To use XPath to set a file field named testFileField that doesn't exist in a form:
    
<htmlunit-set-text-field
functionId="Set the testFileField field to 'some value' and set it against type just for grins."
xpath="//input[@name='testFileField' and @type='file']"
value="some value"/>

Take a look at this tag's API docs and source code for more information.

Attribute NameContext NameDescriptionDefaultRequiredType
form

The identifier of the form. Value indentifiers are, the name, id, index or XPath expression Only the form or xpath attribute can be set at once

falsejava.lang.String
fieldName

The field name in the form.

falsejava.lang.String
value

The value to set the text field to

falsejava.lang.String
xpath

The xpath that matches the desired text field

falsejava.lang.String
functionId

The id of this function. This is used in the macro as a short description of the function

truejava.lang.String
breakPoint

Tells the GUI to stop at this functional point

falseboolean
precondition

Specifies this is a precondition

falseboolean
postcondition

Specifies this is a postcondition and will therefore get executed even if a previous functional point or session tag failed.

falseboolean
expectFailure

Specifies a failure is expected.

falseboolean
expectException

Specifies an exception is expected.

falseboolean
functionDelay

The delay time to use at the end of each functional point

-1falselong

htmlunit-set-hidden-field

A tag which sets a hidden field to the provided value.

To use XPath to set a hidden field named testHiddenField that exists in a form with the name testform:

    
<htmlunit-set-hidden-field
functionId="Set the testHiddenField field to 'some value'"
xpath="//form[@name='testform']/input[@name='testHiddenField']"
value="some value"/>
To use XPath to set a hidden field named testHiddenField that doesn't exist in a form:
    
<htmlunit-set-hidden-field
functionId="Set the testHiddenField field to 'some value'"
xpath="//input[@name='testHiddenField']"
value="some value"/>
To to set a hidden field named testHiddenField that exists in a form with id or name of form_test w/o using XPath:
    
<htmlunit-set-hidden-field
functionId="Set the testHiddenField field to 'some value'"
form="form_test"
fieldName="testHiddenField"
value="some value"/>
To to set a hidden field named testHiddenField that exists in the 2nd form form_test w/o using XPath:
    
<htmlunit-set-hidden-field
functionId="Set the testHiddenField field to 'some value'"
form="2"
fieldName="testHiddenField"
value="some value"/>
To to set a hidden field named testHiddenField that exists in form define by //table/tr[3]/td/form XPath:
    
<htmlunit-set-hidden-field
functionId="Set the testHiddenField field to 'some value'"
form="//table/tr[3]/td/form"
fieldName="testHiddenField"
value="some value"/>

Take a look at this tag's API docs and source code for more information.

Attribute NameContext NameDescriptionDefaultRequiredType
form

The identifier of the form. Value indentifiers are, the name, id, index or XPath expression Only the form or xpath attribute can be set at once

falsejava.lang.String
fieldName

The field name in the form.

falsejava.lang.String
value

The value to set the text field to

falsejava.lang.String
xpath

The xpath that matches the desired text field

falsejava.lang.String
functionId

The id of this function. This is used in the macro as a short description of the function

truejava.lang.String
breakPoint

Tells the GUI to stop at this functional point

falseboolean
precondition

Specifies this is a precondition

falseboolean
postcondition

Specifies this is a postcondition and will therefore get executed even if a previous functional point or session tag failed.

falseboolean
expectFailure

Specifies a failure is expected.

falseboolean
expectException

Specifies an exception is expected.

falseboolean
functionDelay

The delay time to use at the end of each functional point

-1falselong

htmlunit-set-password-field

A tag which sets a password field to the provided value.

To use XPath to set a text field named testPasswordField that exists in a form with the name testform:

    
<htmlunit-set-password-field
functionId="Set the testTextField field to 'some value'"
xpath="//form[@name='testform]/input[@name='testPasswordField']"
value="some value"/>
To use XPath to set a password field named testPasswordField that doesn't exist in a form:
    
<htmlunit-set-password-field
functionId="Set the testTextField field to 'some value'"
xpath="//input[@name='testPasswordField']"
value="some value"/>
To to set a password field named testPasswordField that exists in a form with id or name of form_test w/o using XPath:
    
<htmlunit-set-password-field
functionId="Set the testTextField field to 'some value'"
form="form_test"
fieldName="testPasswordField"
value="some value"/>
To to set a password field named testPasswordField that exists in the 2nd form form_test w/o using XPath:
    
<htmlunit-set-password-field
functionId="Set the testTextField field to 'some value'"
form="2"
fieldName="testPasswordField"
value="some value"/>
To to set a password field named testPasswordField that exists in form define by //table/tr[3]/td/form XPath:
    
<htmlunit-set-password-field
functionId="Set the testTextField field to 'some value'"
form="//table/tr[3]/td/form"
fieldName="testPasswordField"
value="some value"/>

Take a look at this tag's API docs and source code for more information.

Attribute NameContext NameDescriptionDefaultRequiredType
form

The identifier of the form. Value indentifiers are, the name, id, index or XPath expression Only the form or xpath attribute can be set at once

falsejava.lang.String
fieldName

The field name in the form.

falsejava.lang.String
value

The value to set the text field to

falsejava.lang.String
xpath

The xpath that matches the desired text field

falsejava.lang.String
functionId

The id of this function. This is used in the macro as a short description of the function

truejava.lang.String
breakPoint

Tells the GUI to stop at this functional point

falseboolean
precondition

Specifies this is a precondition

falseboolean
postcondition

Specifies this is a postcondition and will therefore get executed even if a previous functional point or session tag failed.

falseboolean
expectFailure

Specifies a failure is expected.

falseboolean
expectException

Specifies an exception is expected.

falseboolean
functionDelay

The delay time to use at the end of each functional point

-1falselong

htmlunit-set-radio-button

This tag is used to set or unset checkboxes defined by a given XPath expression.

To use XPath to check a radio button named rb_1 that exists in a form with the name testform:

    
<htmlunit-set-radio-button
functionId="Check the radio button named rb_1"
xpath="//form[@name='testform']/input[@name='rb_1']"
checked="true"/>

To use XPath to uncheck a checkbox named cb_1 that exists in a form with the name testform:

    
<htmlunit-set-radio-button
functionId="Uncheck the radio button named rb_1"
xpath="//form[@name='testform']/input[@name='rb_1']"
checked="false"/>

To use the form and the field name to check a radio button named rb_1 that exists in a form with the name testform:

    
<htmlunit-set-radio-button
functionId="Check the radio button named rb_1"
form="testform"
fieldName="rb_1"
checked="true"/>

To use the form, field name and value to check a radio button named rb_1 with the value rb_val1 that exists in a form with the name testform:

    
<htmlunit-set-radio-button
functionId="Check the radio button named rb_1"
form="testform"
fieldName="rb_1"
value="rb_val1"
checked="true"/>

Take a look at this tag's API docs and source code for more information.

Attribute NameContext NameDescriptionDefaultRequiredType
checked

To check/uncheck the given checkbox.

falsejava.lang.Boolean
form

The identifier of the form. Value indentifiers are, the name, id, index or XPath expression Only the form or xpath attribute can be set at once

falsejava.lang.String
fieldName

The field name in the form.

falsejava.lang.String
value

The value to set the text field to

falsejava.lang.String
xpath

The xpath that matches the desired text field

falsejava.lang.String
functionId

The id of this function. This is used in the macro as a short description of the function

truejava.lang.String
breakPoint

Tells the GUI to stop at this functional point

falseboolean
precondition

Specifies this is a precondition

falseboolean
postcondition

Specifies this is a postcondition and will therefore get executed even if a previous functional point or session tag failed.

falseboolean
expectFailure

Specifies a failure is expected.

falseboolean
expectException

Specifies an exception is expected.

falseboolean
functionDelay

The delay time to use at the end of each functional point

-1falselong

htmlunit-set-select-field

This tag is used to select or unselect options in a select field.

To use XPath to select a select field named sf_1 of an option with the value attribute of sfo_1 that exists in a form with the name testform:

    
<htmlunit-set-select-field
functionId="Select the select field option with the value 'sfo_1'"
xpath="//form[@name='testform']/select[@name='sf_1']/option[@value='sfo_1']"
selected="true"/>

To use XPath to unselect a sf_1 select field option with the value attribute of sfo_1 that exists in a form with the name testform:

    
<htmlunit-set-select-field
functionId="Select the select field option with the value 'sfo_1'"
xpath="//form[@name='testform']/select[@name='sf_1']/option[@value='sfo_1']"
selected="false"/>

To use the form, field name and option value to select an option with the value sfo_1 that exists in a form with the name testform:

    
<htmlunit-set-select-field
functionId="select the select field option with the value attribute of 'sfo_1'"
form="testform"
fieldName="sf_1"
optionValue="sfo_1"
selected="true"/>

To use the form, field name and option text to select an option by it's displayed text Select Me that exists in a form with the name testform:

    
<htmlunit-set-select-field
functionId="select the select field option with the displayed text 'Select Me'"
form="testform"
fieldName="sf_1"
optionText="Select Me"
selected="true"/>

To use the form, field name and option text to select the 3rd option that exists in a form with the name testform:

    
<htmlunit-set-select-field
functionId="select the third select field option"
form="testform"
fieldName="sf_1"
optionIndex="2"
selected="true"/>

Take a look at this tag's API docs and source code for more information.

Attribute NameContext NameDescriptionDefaultRequiredType
form

The identifier of the form. Value indentifiers are, the name, id, index or XPath expression Only the form or xpath attribute can be set at once

falsejava.lang.String
fieldName

The field name in the form.

falsejava.lang.String
optionValue

The the value of the option's value attribute

falsejava.lang.String
optionIndex

The position of the option to select. The first displayed option would be 1

-1falseint
optionText

The the displayed text of the option's value attribute

falsejava.lang.String
xpath

The xpath that matches the desired option to select.

falsejava.lang.String
selected

The xpath that matches the desired option to select.

truejava.lang.Boolean
functionId

The id of this function. This is used in the macro as a short description of the function

truejava.lang.String
breakPoint

Tells the GUI to stop at this functional point

falseboolean
precondition

Specifies this is a precondition

falseboolean
postcondition

Specifies this is a postcondition and will therefore get executed even if a previous functional point or session tag failed.

falseboolean
expectFailure

Specifies a failure is expected.

falseboolean
expectException

Specifies an exception is expected.

falseboolean
functionDelay

The delay time to use at the end of each functional point

-1falselong

htmlunit-set-text-area

A tag which sets a text area to the provided value.

To use XPath to set a text field named testTextArea that exists in a form with the name testform:

    
<htmlunit-set-text-area
functionId="Set the testTextArea field to 'some value'"
xpath="//form[@name='testform']/textarea[@name='testTextArea']"
value="some value"/>
To use XPath to set a text area named testTextArea that doesn't exist in a form:
    
<htmlunit-set-text-area
functionId="Set the testTextArea field to 'some value'"
xpath="//input[@name='testTextArea']"
value="some value"/>
To to set a text area named testTextArea that exists in a form with id or name of form_test w/o using XPath:
    
<htmlunit-set-text-area
functionId="Set the testTextArea field to 'some value'"
form="form_test"
fieldName="testTextArea"
value="some value"/>
To to set a text area named testTextArea that exists in the 2nd form form_test w/o using XPath:
    
<htmlunit-set-text-area
functionId="Set the testTextArea field to 'some value'"
form="2"
fieldName="testTextArea"
value="some value"/>
To to set a text field named testTextArea that exists in form define by //table/tr[3]/td/form XPath:
    
<htmlunit-set-text-area
functionId="Set the testTextArea field to 'some value'"
form="//table/tr[3]/td/form"
fieldName="testTextArea"
value="some value"/>

Take a look at this tag's API docs and source code for more information.

Attribute NameContext NameDescriptionDefaultRequiredType
form

The identifier of the form. Value indentifiers are, the name, id, index or XPath expression Only the form or xpath attribute can be set at once

falsejava.lang.String
fieldName

The field name in the form.

falsejava.lang.String
value

The value to set the text field to

falsejava.lang.String
xpath

The xpath that matches the desired text field

falsejava.lang.String
functionId

The id of this function. This is used in the macro as a short description of the function

truejava.lang.String
breakPoint

Tells the GUI to stop at this functional point

falseboolean
precondition

Specifies this is a precondition

falseboolean
postcondition

Specifies this is a postcondition and will therefore get executed even if a previous functional point or session tag failed.

falseboolean
expectFailure

Specifies a failure is expected.

falseboolean
expectException

Specifies an exception is expected.

falseboolean
functionDelay

The delay time to use at the end of each functional point

-1falselong

htmlunit-set-text-field

A tag which sets a text field to the provided value.

To use XPath to set a text field named testTextField that exists in a form with the name testform:

    
<htmlunit-set-text-field
functionId="Set the testTextField field to 'some value'"
xpath="//form[@name='testform']/input[@name='testTextField']"
value="some value"/>
To use XPath to set a text field named testTextField that doesn't exist in a form:
    
<htmlunit-set-text-field
functionId="Set the testTextField field to 'some value'"
xpath="//input[@name='testTextField']"
value="some value"/>
To to set a text field named testTextField that exists in a form with id or name of form_test w/o using XPath:
    
<htmlunit-set-text-field
functionId="Set the testTextField field to 'some value'"
form="form_test"
fieldName="testTextField"
value="some value"/>
To to set a text field named testTextField that exists in the 2nd form form_test w/o using XPath:
    
<htmlunit-set-text-field
functionId="Set the testTextField field to 'some value'"
form="2"
fieldName="testTextField"
value="some value"/>
To to set a text field named testTextField that exists in form define by //table/tr[3]/td/form XPath:
    
<htmlunit-set-text-field
functionId="Set the testTextField field to 'some value'"
form="//table/tr[3]/td/form"
fieldName="testTextField"
value="some value"/>

Take a look at this tag's API docs and source code for more information.

Attribute NameContext NameDescriptionDefaultRequiredType
form

The identifier of the form. Value indentifiers are, the name, id, index or XPath expression Only the form or xpath attribute can be set at once

falsejava.lang.String
fieldName

The field name in the form.

falsejava.lang.String
value

The value to set the text field to

falsejava.lang.String
xpath

The xpath that matches the desired text field

falsejava.lang.String
functionId

The id of this function. This is used in the macro as a short description of the function

truejava.lang.String
breakPoint

Tells the GUI to stop at this functional point

falseboolean
precondition

Specifies this is a precondition

falseboolean
postcondition

Specifies this is a postcondition and will therefore get executed even if a previous functional point or session tag failed.

falseboolean
expectFailure

Specifies a failure is expected.

falseboolean
expectException

Specifies an exception is expected.

falseboolean
functionDelay

The delay time to use at the end of each functional point

-1falselong

htmlunit-validate

A generic validate tag used to validate HTML. If no attributes are set, then no validation occurs. If no validation occurs, then this tag will fail.

To validate a page with the title Yo World!:

    
<htmlunit-validate
functionId="Verify that the title is 'Yo World!'"
title="Yo World!"/>
If you want a better error message when a failure occurs, then pass in the msg attribute.
    
<htmlunit-validate
functionId="Verify that the title is 'Yo World!'"
title="Yo World!"
msg="We must be on the wrong page."/>
If you want validate that some text simple exists on the page anywhere:
    
<htmlunit-validate
functionId="Verify that 'some text' exists on the current page"
textPresent="some text"/>
If you want to use xpath to validate, then simply use the xpath attribute:
    
<htmlunit-validate
functionId="Verify that 'some text' exists on the current page"
xpath="//body/table[2]/tr[@id='checking_account' and text=()='234333433']"/>
You can, supply multiple attributes. If you supply multiple attributes and the msg attribute, then the msg will be used on any failure.

Take a look at this tag's API docs and source code for more information.

Attribute NameContext NameDescriptionDefaultRequiredType
title

The expected title of the page

falsejava.lang.String
textPresent

The expected text in the page

falsejava.lang.String
xpath

The xpath to evaluate

falsejava.lang.String
msg

The message to display in if a failure occurs

falsejava.lang.String
functionId

The id of this function. This is used in the macro as a short description of the function

truejava.lang.String
breakPoint

Tells the GUI to stop at this functional point

falseboolean
precondition

Specifies this is a precondition

falseboolean
postcondition

Specifies this is a postcondition and will therefore get executed even if a previous functional point or session tag failed.

falseboolean
expectFailure

Specifies a failure is expected.

falseboolean
expectException

Specifies an exception is expected.

falseboolean
functionDelay

The delay time to use at the end of each functional point

-1falselong