Java Doc for WebForm.java in  » Testing » HttpUnit » com » meterware » httpunit » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Testing » HttpUnit » com.meterware.httpunit 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.meterware.httpunit.ParameterHolder
      com.meterware.httpunit.WebRequestSource
         com.meterware.httpunit.WebForm

WebForm
public class WebForm extends WebRequestSource (Code)
This class represents a form in an HTML page. Users of this class may examine the parameters defined for the form, the structure of the form (as a DOM), or the text of the form. They may also create a WebRequest to simulate the submission of the form.
author:
   Russell Gold

Inner Class :public class Scriptable extends HTMLElementScriptable implements NamedDelegate
Inner Class :class NoSuchParameterException extends IllegalRequestParameterException
Inner Class :class IllegalUnnamedSubmitButtonException extends IllegalRequestParameterException
Inner Class :class IllegalSubmitButtonException extends IllegalRequestParameterException
Inner Class :class DisabledSubmitButtonException extends IllegalStateException

Field Summary
final public static  HTMLElementPredicateMATCH_NAME
     Predicate to match a link's name.

Constructor Summary
 WebForm(WebResponse response, URL baseURL, Node node, FrameSelector frame, String defaultTarget, String characterSet)
     Contructs a web form given the URL of its source page and the DOM extracted from that page.

Method Summary
 voidaddFormControl(FormControl control)
    
protected  voidaddPresetParameter(String name, String value)
     Records a parameter defined by including it in the destination URL.
 WebResponsedoFormSubmit(SubmitButton button)
     Submits the form without also invoking the button's "onclick" event.
 WebResponsedoFormSubmit(SubmitButton button, int x, int y)
    
public  StringgetAction()
     Returns the action defined for this form.
public  ButtongetButton(HTMLElementPredicate predicate, Object criteria)
    
public  ButtongetButtonWithID(String buttonID)
     Convenience method which returns the button with the specified ID.
public  Button[]getButtons()
     Returns an array containing all of the buttons defined for this form.
public  StringgetCharacterSet()
     Returns the character set encoding for this form.
 FormControlgetControlWithID(String id)
     Returns the form control which is part of this form with the specified ID.
protected  StringgetEmptyParameterValue()
    
public  StringgetMethod()
     Returns the method defined for this form.
public  intgetNumTextParameters(String name)
     Returns the number of text parameters in this form with the specified name.
public  String[]getOptionValues(String name)
     Returns the option values defined for the specified parameter name.
public  String[]getOptions(String name)
     Returns the displayed options defined for the specified parameter name.
public  String[]getParameterNames()
     Returns an array containing the names of the parameters defined for this form.
public  StringgetParameterValue(String name)
     Returns the default value of the named parameter.
public  String[]getParameterValues(String name)
     Returns the multiple default values of the named parameter.
public  WebRequestgetRequest(String submitButtonName, String submitButtonValue)
     Creates and returns a web request which will simulate the submission of this form with a button with the specified name and value.
public  WebRequestgetRequest(String submitButtonName)
     Creates and returns a web request which will simulate the submission of this form with a button with the specified name.
public  WebRequestgetRequest(SubmitButton button)
     Creates and returns a web request which will simulate the submission of this form by pressing the specified button.
public  WebRequestgetRequest(SubmitButton button, int x, int y)
     Creates and returns a web request which will simulate the submission of this form by pressing the specified button.
public  WebRequestgetRequest()
     Creates and returns a web request which will simulate the submission of this form with an unnamed submit button.
public  ScriptableDelegategetScriptableDelegate()
     Returns the scriptable delegate.
public  ScriptablegetScriptableObject()
     Returns an object which provides scripting access to this form.
public  SubmitButtongetSubmitButton(String name)
     Returns the submit button defined in this form with the specified name.
public  SubmitButtongetSubmitButton(String name, String value)
     Returns the submit button defined in this form with the specified name and value.
public  SubmitButtongetSubmitButtonWithID(String ID)
     Returns the submit button defined in this form with the specified ID.
public  SubmitButton[]getSubmitButtons()
     Returns an array containing the submit buttons defined for this form.
public  booleanhasParameterNamed(String soughtName)
     Returns true if a parameter with given name exists in this form.
public  booleanhasParameterStartingWithPrefix(String prefix)
    
public  booleanisDisabledParameter(String name)
     Returns true if the named parameter is disabled.
public  booleanisFileParameter(String name)
     Returns true if the named parameter accepts files for upload.
public  booleanisHiddenParameter(String name)
     Returns true if the named parameter is hidden.
public  booleanisMultiValuedParameter(String name)
     Returns true if the named parameter accepts multiple values.
public  booleanisReadOnlyParameter(String name)
     Returns true if the named parameter is read-only.
public  booleanisSubmitAsMime()
     Returns true if this form is to be submitted using mime encoding (the default is URL encoding).
public  booleanisTextParameter(String name)
     Returns true if the named parameter accepts free-form text.
 FormControlnewFormControl(Node child)
    
public  WebRequestnewUnvalidatedRequest(SubmitButton button)
     Creates and returns a web request which includes the specified button.
public  WebRequestnewUnvalidatedRequest(SubmitButton button, int x, int y)
     Creates and returns a web request which includes the specified button and position.
public  WebRequestnewUnvalidatedRequest()
     Creates and returns a web request based on the current state of this form.
 voidrecordParameters(ParameterProcessor processor)
     Iterates through the parameters in this holder, recording them in the supplied parameter processor.
 voidrecordPredefinedParameters(ParameterProcessor processor)
     Iterates through the fixed, predefined parameters in this holder, recording them in the supplied parameter processor.\ These parameters always go on the URL, no matter what encoding method is used.
public  voidremoveParameter(String name)
     Removes a parameter name from this collection.
public  voidreset()
     Resets all parameters to their initial values.
 voidselectImageButtonPosition(SubmitButton imageButton, int x, int y)
     Specifies the position at which an image button (if any) was clicked.
public  voidsetCheckbox(String name, boolean state)
     Sets the value of the specified checkbox parameter.
public  voidsetCheckbox(String name, String value, boolean state)
     Sets the value of the specified checkbox parameter.
public  voidsetParameter(String name, String value)
     Sets the value of a parameter in this form.
public  voidsetParameter(String name, String[] values)
     Sets the multiple values of a parameter in this form.
public  voidsetParameter(String name, UploadFileSpec[] files)
     Sets the multiple values of a file upload parameter in a web request.
public  voidsetParameter(String name, File file)
     Sets the single value of a file upload parameter in this form.
 voidsetSubmitAsMime(boolean mimeEncoded)
    
public  WebResponsesubmit()
     Submits this form using the web client from which it was originally obtained.
public  WebResponsesubmit(SubmitButton button)
     Submits this form using the web client from which it was originally obtained.
public  WebResponsesubmit(SubmitButton button, int x, int y)
     Submits this form using the web client from which it was originally obtained.
public  WebResponsesubmitNoButton()
     Submits this form using the web client from which it was originally obtained, ignoring any buttons defined for the form.
protected  WebResponsesubmitRequest(String event, WebRequest request)
    
public  voidtoggleCheckbox(String name)
     Toggles the value of the specified checkbox parameter.
public  voidtoggleCheckbox(String name, String value)
     Toggles the value of the specified checkbox parameter.

Field Detail
MATCH_NAME
final public static HTMLElementPredicate MATCH_NAME(Code)
Predicate to match a link's name. *




Constructor Detail
WebForm
WebForm(WebResponse response, URL baseURL, Node node, FrameSelector frame, String defaultTarget, String characterSet)(Code)
Contructs a web form given the URL of its source page and the DOM extracted from that page.




Method Detail
addFormControl
void addFormControl(FormControl control)(Code)



addPresetParameter
protected void addPresetParameter(String name, String value)(Code)
Records a parameter defined by including it in the destination URL. Ignores any parameters whose name matches a form control.



doFormSubmit
WebResponse doFormSubmit(SubmitButton button) throws IOException, SAXException(Code)
Submits the form without also invoking the button's "onclick" event.



doFormSubmit
WebResponse doFormSubmit(SubmitButton button, int x, int y) throws IOException, SAXException(Code)



getAction
public String getAction()(Code)
Returns the action defined for this form.



getButton
public Button getButton(HTMLElementPredicate predicate, Object criteria)(Code)



getButtonWithID
public Button getButtonWithID(String buttonID)(Code)
Convenience method which returns the button with the specified ID.



getButtons
public Button[] getButtons()(Code)
Returns an array containing all of the buttons defined for this form.



getCharacterSet
public String getCharacterSet()(Code)
Returns the character set encoding for this form.



getControlWithID
FormControl getControlWithID(String id)(Code)
Returns the form control which is part of this form with the specified ID.



getEmptyParameterValue
protected String getEmptyParameterValue()(Code)



getMethod
public String getMethod()(Code)
Returns the method defined for this form.



getNumTextParameters
public int getNumTextParameters(String name)(Code)
Returns the number of text parameters in this form with the specified name.



getOptionValues
public String[] getOptionValues(String name)(Code)
Returns the option values defined for the specified parameter name.



getOptions
public String[] getOptions(String name)(Code)
Returns the displayed options defined for the specified parameter name.



getParameterNames
public String[] getParameterNames()(Code)
Returns an array containing the names of the parameters defined for this form.



getParameterValue
public String getParameterValue(String name)(Code)
Returns the default value of the named parameter. If the parameter does not exist returns null.



getParameterValues
public String[] getParameterValues(String name)(Code)
Returns the multiple default values of the named parameter.



getRequest
public WebRequest getRequest(String submitButtonName, String submitButtonValue)(Code)
Creates and returns a web request which will simulate the submission of this form with a button with the specified name and value.



getRequest
public WebRequest getRequest(String submitButtonName)(Code)
Creates and returns a web request which will simulate the submission of this form with a button with the specified name.



getRequest
public WebRequest getRequest(SubmitButton button)(Code)
Creates and returns a web request which will simulate the submission of this form by pressing the specified button. If the button is null, simulates the pressing of the default button.



getRequest
public WebRequest getRequest(SubmitButton button, int x, int y)(Code)
Creates and returns a web request which will simulate the submission of this form by pressing the specified button. If the button is null, simulates the pressing of the default button.



getRequest
public WebRequest getRequest()(Code)
Creates and returns a web request which will simulate the submission of this form with an unnamed submit button.



getScriptableDelegate
public ScriptableDelegate getScriptableDelegate()(Code)
Returns the scriptable delegate.



getScriptableObject
public Scriptable getScriptableObject()(Code)
Returns an object which provides scripting access to this form.



getSubmitButton
public SubmitButton getSubmitButton(String name)(Code)
Returns the submit button defined in this form with the specified name. If more than one such button exists, will return the first found. If no such button is found, will return null.



getSubmitButton
public SubmitButton getSubmitButton(String name, String value)(Code)
Returns the submit button defined in this form with the specified name and value. If more than one such button exists, will return the first found. If no such button is found, will return null.



getSubmitButtonWithID
public SubmitButton getSubmitButtonWithID(String ID)(Code)
Returns the submit button defined in this form with the specified ID. If more than one such button exists, will return the first found. If no such button is found, will return null.



getSubmitButtons
public SubmitButton[] getSubmitButtons()(Code)
Returns an array containing the submit buttons defined for this form.



hasParameterNamed
public boolean hasParameterNamed(String soughtName)(Code)
Returns true if a parameter with given name exists in this form.



hasParameterStartingWithPrefix
public boolean hasParameterStartingWithPrefix(String prefix)(Code)
Returns true if a parameter starting with a given name exists,



isDisabledParameter
public boolean isDisabledParameter(String name)(Code)
Returns true if the named parameter is disabled. If more than one control exists with the same name, will return true only if all such controls are read-only.



isFileParameter
public boolean isFileParameter(String name)(Code)
Returns true if the named parameter accepts files for upload.



isHiddenParameter
public boolean isHiddenParameter(String name)(Code)
Returns true if the named parameter is hidden. If more than one control exists with the same name, will return true only if all such controls are hidden.



isMultiValuedParameter
public boolean isMultiValuedParameter(String name)(Code)
Returns true if the named parameter accepts multiple values.



isReadOnlyParameter
public boolean isReadOnlyParameter(String name)(Code)
Returns true if the named parameter is read-only. If more than one control exists with the same name, will return true only if all such controls are read-only.



isSubmitAsMime
public boolean isSubmitAsMime()(Code)
Returns true if this form is to be submitted using mime encoding (the default is URL encoding).



isTextParameter
public boolean isTextParameter(String name)(Code)
Returns true if the named parameter accepts free-form text.



newFormControl
FormControl newFormControl(Node child)(Code)



newUnvalidatedRequest
public WebRequest newUnvalidatedRequest(SubmitButton button)(Code)
Creates and returns a web request which includes the specified button. If no button is specified, will include the default button, if any. No parameter validation will be done on the returned request and no scripts will be run when it is submitted.



newUnvalidatedRequest
public WebRequest newUnvalidatedRequest(SubmitButton button, int x, int y)(Code)
Creates and returns a web request which includes the specified button and position. If no button is specified, will include the default button, if any. No parameter validation will be done on the returned request and no scripts will be run when it is submitted.



newUnvalidatedRequest
public WebRequest newUnvalidatedRequest()(Code)
Creates and returns a web request based on the current state of this form. No parameter validation will be done and there is no guarantee over the order of parameters transmitted.



recordParameters
void recordParameters(ParameterProcessor processor) throws IOException(Code)
Iterates through the parameters in this holder, recording them in the supplied parameter processor.



recordPredefinedParameters
void recordPredefinedParameters(ParameterProcessor processor) throws IOException(Code)
Iterates through the fixed, predefined parameters in this holder, recording them in the supplied parameter processor.\ These parameters always go on the URL, no matter what encoding method is used.



removeParameter
public void removeParameter(String name)(Code)
Removes a parameter name from this collection.



reset
public void reset()(Code)
Resets all parameters to their initial values.



selectImageButtonPosition
void selectImageButtonPosition(SubmitButton imageButton, int x, int y)(Code)
Specifies the position at which an image button (if any) was clicked.



setCheckbox
public void setCheckbox(String name, boolean state)(Code)
Sets the value of the specified checkbox parameter.
Parameters:
  name - the name of the checkbox parameter
Parameters:
  state - the new state of the checkbox
throws:
  IllegalArgumentException - if the specified parameter is not a checkbox or there is more than onecontrol with that name.
since:
   1.5.4



setCheckbox
public void setCheckbox(String name, String value, boolean state)(Code)
Sets the value of the specified checkbox parameter.
Parameters:
  name - the name of the checkbox parameter
Parameters:
  value - of the checkbox parameter
Parameters:
  state - the new state of the checkbox
throws:
  IllegalArgumentException - if the specified parameter is not a checkbox or if there is no checkboxwith the specified name and value.
since:
   1.6



setParameter
public void setParameter(String name, String value)(Code)
Sets the value of a parameter in this form.



setParameter
public void setParameter(String name, String[] values)(Code)
Sets the multiple values of a parameter in this form. This is generally used when there are multiple controls with the same name in the form.



setParameter
public void setParameter(String name, UploadFileSpec[] files)(Code)
Sets the multiple values of a file upload parameter in a web request.



setParameter
public void setParameter(String name, File file)(Code)
Sets the single value of a file upload parameter in this form. A more convenient way to do this than using WebForm.setParameter(String,UploadFileSpec[])
since:
   1.6



setSubmitAsMime
void setSubmitAsMime(boolean mimeEncoded)(Code)



submit
public WebResponse submit() throws IOException, SAXException(Code)
Submits this form using the web client from which it was originally obtained.



submit
public WebResponse submit(SubmitButton button) throws IOException, SAXException(Code)
Submits this form using the web client from which it was originally obtained. Will usually return the result of that submission; however, if the submit button's 'onclick' or the form's 'onsubmit' event is triggered and inhibits the submission, will return the updated contents of the frame containing this form.



submit
public WebResponse submit(SubmitButton button, int x, int y) throws IOException, SAXException(Code)
Submits this form using the web client from which it was originally obtained. Will usually return the result of that submission; however, if the submit button's 'onclick' or the form's 'onsubmit' event is triggered and inhibits the submission, will return the updated contents of the frame containing this form.
since:
   1.6



submitNoButton
public WebResponse submitNoButton() throws SAXException, IOException(Code)
Submits this form using the web client from which it was originally obtained, ignoring any buttons defined for the form.
since:
   1.6



submitRequest
protected WebResponse submitRequest(String event, WebRequest request) throws IOException, SAXException(Code)



toggleCheckbox
public void toggleCheckbox(String name)(Code)
Toggles the value of the specified checkbox parameter.
Parameters:
  name - the name of the checkbox parameter
throws:
  IllegalArgumentException - if the specified parameter is not a checkbox or there is more than onecontrol with that name.
since:
   1.5.4



toggleCheckbox
public void toggleCheckbox(String name, String value)(Code)
Toggles the value of the specified checkbox parameter.
Parameters:
  name - the name of the checkbox parameter
Parameters:
  value - of the checkbox parameter
throws:
  IllegalArgumentException - if the specified parameter is not a checkbox or if there is no checkboxwith the specified name and value.
since:
   1.6



Methods inherited from com.meterware.httpunit.WebRequestSource
abstract protected void addPresetParameter(String name, String value)(Code)(Java Doc)
public String getAttribute(String name)(Code)(Java Doc)
String getAttribute(String name, String defaultValue)(Code)(Java Doc)
final protected WebResponse getBaseResponse()(Code)(Java Doc)
protected URL getBaseURL()(Code)(Java Doc)
public String getClassName()(Code)(Java Doc)
protected WebResponse getCurrentFrameContents()(Code)(Java Doc)
public Node getDOMSubtree()(Code)(Java Doc)
protected String getDestination()(Code)(Java Doc)
abstract protected String getEmptyParameterValue()(Code)(Java Doc)
public String getFragmentIdentifier()(Code)(Java Doc)
public FrameSelector getFrame()(Code)(Java Doc)
protected HTMLPage getHTMLPage() throws SAXException(Code)(Java Doc)
public String getID()(Code)(Java Doc)
public String getName()(Code)(Java Doc)
protected Node getNode()(Code)(Java Doc)
public String getPageFrame()(Code)(Java Doc)
abstract public String[] getParameterNames()(Code)(Java Doc)
abstract public String[] getParameterValues(String name)(Code)(Java Doc)
String getRelativePage()(Code)(Java Doc)
protected String getRelativeURL()(Code)(Java Doc)
abstract public WebRequest getRequest()(Code)(Java Doc)
public String getTagName()(Code)(Java Doc)
public String getTarget()(Code)(Java Doc)
public String getText()(Code)(Java Doc)
public String getTitle()(Code)(Java Doc)
public boolean isSupportedAttribute(String name)(Code)(Java Doc)
final protected void loadDestinationParameters()(Code)(Java Doc)
protected void setDestination(String destination)(Code)(Java Doc)
protected void setTargetAttribute(String value)(Code)(Java Doc)
protected WebResponse submitRequest(String event, WebRequest request) throws IOException, SAXException(Code)(Java Doc)
final protected WebResponse submitRequest(WebRequest request) throws IOException, SAXException(Code)(Java Doc)

Methods inherited from com.meterware.httpunit.ParameterHolder
String getCharacterSet()(Code)(Java Doc)
abstract String[] getParameterNames()(Code)(Java Doc)
abstract String[] getParameterValues(String name)(Code)(Java Doc)
boolean isFileParameter(String name)(Code)(Java Doc)
abstract boolean isSubmitAsMime()(Code)(Java Doc)
abstract void recordParameters(ParameterProcessor processor) throws IOException(Code)(Java Doc)
abstract void recordPredefinedParameters(ParameterProcessor processor) throws IOException(Code)(Java Doc)
abstract void removeParameter(String name)(Code)(Java Doc)
void selectImageButtonPosition(SubmitButton imageButton, int x, int y)(Code)(Java Doc)
abstract void setParameter(String name, String value)(Code)(Java Doc)
abstract void setParameter(String name, String[] values)(Code)(Java Doc)
abstract void setParameter(String name, UploadFileSpec[] files)(Code)(Java Doc)
abstract void setSubmitAsMime(boolean mimeEncoded)(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.