com.atlassian.jira.functest.framework.util.form
Class FormParameterUtil

java.lang.Object
  extended by com.atlassian.jira.functest.framework.util.form.FormParameterUtil

public class FormParameterUtil
extends Object

This class is used to modify form requests that are to be submitted It does this by modifying the request on a form before submitting it. If you attempt to resunbmit a form then an assertion error ewill be thrown. also note that for duration from construction to form submission the validation of parameter values in the test is disabled. You have to work with the returned DOM, rather than with the tester, as the state of the request and response objects will not be in sync

Since:
v4.2

Constructor Summary
FormParameterUtil(net.sourceforge.jwebunit.WebTester tester, String formIdentifierOrName, String submitButtonName)
           
 
Method Summary
 void addOptionToHtmlSelect(String select, String[] value)
          allows you to add options to an existing select HTML element
 void replaceOptionsinHtmlSelect(String select, String[] value)
          allows you to replace the options in an existing select HTML element
 void setFormElement(String formElementName, String value)
          allows you to replace the options in an existing select HTML element
 void setParameters(Map<String,String[]> parameters)
          allows you to set the value of any parameter in the request
 Node submitForm()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FormParameterUtil

public FormParameterUtil(net.sourceforge.jwebunit.WebTester tester,
                         String formIdentifierOrName,
                         String submitButtonName)
Parameters:
tester - the currently executing WebTester
formIdentifierOrName - either the id or the name of the form you want to modify
submitButtonName - the name of the submit button, if null then the default button is used
Method Detail

addOptionToHtmlSelect

public void addOptionToHtmlSelect(String select,
                                  String[] value)
allows you to add options to an existing select HTML element

Parameters:
select - the name of the select to which to add an option
value - a string array containing the option values you want to submit

replaceOptionsinHtmlSelect

public void replaceOptionsinHtmlSelect(String select,
                                       String[] value)
allows you to replace the options in an existing select HTML element

Parameters:
select - the name of the select to which to repalce all options
value - a string array containing the option values you want to submit

setFormElement

public void setFormElement(String formElementName,
                           String value)
allows you to replace the options in an existing select HTML element

Parameters:
formElementName - the name of the formElement
value - a string containing the value you want to submit

setParameters

public void setParameters(Map<String,String[]> parameters)
allows you to set the value of any parameter in the request

Parameters:
parameters - A map containing the names and values of the parmeters to be submited

submitForm

public Node submitForm()
Returns:
The DOM Document that represents the returned response. To guarantee lower case the DomNodeCopier is used to return a shallow copy of the Document


Copyright © 2002-2012 Atlassian. All Rights Reserved.