com.canoo.webtest.util
Class FormUtil

java.lang.Object
  extended by com.canoo.webtest.util.FormUtil

public class FormUtil
extends Object

Utilities for working with forms.

Author:
Paul King

Constructor Summary
FormUtil()
           
 
Method Summary
static com.gargoylesoftware.htmlunit.html.HtmlForm findFormByIndex(com.gargoylesoftware.htmlunit.html.HtmlPage currentResp, String indexStr)
           
static com.gargoylesoftware.htmlunit.html.HtmlForm findFormByName(com.gargoylesoftware.htmlunit.html.HtmlPage currentResp, String name)
           
static com.gargoylesoftware.htmlunit.html.HtmlForm findFormForField(Context context, String givenFormName, String tag, String type, String name, Step step)
          Gets the form from the current response containing the desired field.
static com.gargoylesoftware.htmlunit.html.HtmlForm findFormForTextField(Context context, String givenFormName, String name, Step step)
          Gets the form from the current response containing the desired text field.
static boolean hasTextField(com.gargoylesoftware.htmlunit.html.HtmlForm form, String name)
          Indicates if the form has a "text field" (text, password or textarea) with the given name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FormUtil

public FormUtil()
Method Detail

hasTextField

public static boolean hasTextField(com.gargoylesoftware.htmlunit.html.HtmlForm form,
                                   String name)
Indicates if the form has a "text field" (text, password or textarea) with the given name.


findFormForField

public static com.gargoylesoftware.htmlunit.html.HtmlForm findFormForField(Context context,
                                                                           String givenFormName,
                                                                           String tag,
                                                                           String type,
                                                                           String name,
                                                                           Step step)
Gets the form from the current response containing the desired field. If there is a current form then this form is considered, else the first form containing such a field (this form is then set as the current form for further calls).
Note: the test is currently only performed on the name of the field.

Parameters:
context -
givenFormName -
tag - the html tag corresponding to the field
type - the type of the input field (html attribute "type") if tag is "input"
name - the name of the input field (html attribute "name")
step -
Returns:
null if no form found.

findFormForTextField

public static com.gargoylesoftware.htmlunit.html.HtmlForm findFormForTextField(Context context,
                                                                               String givenFormName,
                                                                               String name,
                                                                               Step step)
Gets the form from the current response containing the desired text field. If there is a current form then this form is considered, else the first form containing such a field (this form is then set a the current form for further calls).

Parameters:
context -
givenFormName -
name - the name of the text field of interest (<input type="text"...> or <input type="password" ...> or <textarea ...>...</textarea>)
step -
Returns:
null if no form found.

findFormByName

public static com.gargoylesoftware.htmlunit.html.HtmlForm findFormByName(com.gargoylesoftware.htmlunit.html.HtmlPage currentResp,
                                                                         String name)

findFormByIndex

public static com.gargoylesoftware.htmlunit.html.HtmlForm findFormByIndex(com.gargoylesoftware.htmlunit.html.HtmlPage currentResp,
                                                                          String indexStr)

Copyright © 2001-2007 Canoo Engineering AG, Basel. All rights reserved.