com.canoo.webtest.steps.form
Class SetFileField

java.lang.Object
  extended by org.apache.tools.ant.ProjectComponent
      extended by org.apache.tools.ant.Task
          extended by com.canoo.webtest.steps.Step
              extended by com.canoo.webtest.steps.AbstractBrowserAction
                  extended by com.canoo.webtest.steps.form.AbstractSetFieldStep
                      extended by com.canoo.webtest.steps.form.SetFileField
All Implemented Interfaces:
IBrowserAction, Serializable, Cloneable

public class SetFileField
extends AbstractSetFieldStep

Supports the <input type=\"file\" \.\.\. />form field.

Author:
Marc Guillemot, Paul King
See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.canoo.webtest.steps.form.AbstractSetFieldStep
MESSAGE_ARGUMENT_MISSING, MESSAGE_ARGUMENT_REDUNDANT
 
Fields inherited from class com.canoo.webtest.steps.Step
DEFAULT_DESCRIPTION, ELEMENT_ATTRIBUTE_ID, ELEMENT_ATTRIBUTE_NAME, PROPERTY_TYPE_ANT, PROPERTY_TYPE_ANT_STRICT, PROPERTY_TYPE_DEFAULT, PROPERTY_TYPE_DYNAMIC
 
Fields inherited from class org.apache.tools.ant.Task
target, taskName, taskType, wrapper
 
Fields inherited from class org.apache.tools.ant.ProjectComponent
description, location, project
 
Constructor Summary
SetFileField()
           
 
Method Summary
protected  com.gargoylesoftware.htmlunit.html.HtmlForm findForm()
          Finds the relevant form.
 File getFileName()
           
 boolean isCheckFileExists()
           
protected  boolean keepField(com.gargoylesoftware.htmlunit.html.HtmlElement elt)
          Called by AbstractSetFieldStep.findFields(com.gargoylesoftware.htmlunit.html.HtmlForm) to filter out elements with the correct name but not matching some other selection criteria.
 void setCheckFileExists(boolean b)
          Indicates if WebTest should verify that the file to upload exists.
protected  void setField(com.gargoylesoftware.htmlunit.html.HtmlElement element)
          Sets a field according to the step.
 void setFileName(File filename)
          Sets the name of the file to be uploaded.
protected  void verifyParameters()
          Called to let the step's implementation validate its parameters.
 
Methods inherited from class com.canoo.webtest.steps.form.AbstractSetFieldStep
doExecute, findFields, getFieldIndex, getForLabel, getFormName, getHtmlId, getName, getXpath, selectField, setFieldIndex, setForLabel, setFormName, setHtmlId, setName, setXpath, trimFields
 
Methods inherited from class com.canoo.webtest.steps.AbstractBrowserAction
setSave, setSavePrefix, setSaveResponse
 
Methods inherited from class com.canoo.webtest.steps.Step
addComputedParameters, clone, emptyParamCheck, execute, getComputedParameters, getContext, getDefaultPropertyType, getDescription, getDuration, getParameterDictionary, getStepLabel, getVerifier, getWebtestProperties, getWebtestProperties, getWebtestProperty, getWebtestProperty, handleException, hasDescription, integerParamCheck, isCompleted, isPerformingAction, isStarted, isSuccessful, notifyCompleted, notifyStarted, notifyStepResultsListeners, notifySuccess, nullParamCheck, nullResponseCheck, optionalIntegerParamCheck, paramCheck, positiveOrZeroParamCheck, setStepid, setWebtestProperty, setWebtestProperty, toString
 
Methods inherited from class org.apache.tools.ant.Task
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
 
Methods inherited from class org.apache.tools.ant.ProjectComponent
getDescription, getLocation, getProject, setDescription, setLocation, setProject
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.canoo.webtest.interfaces.IBrowserAction
getTaskName
 

Constructor Detail

SetFileField

public SetFileField()
Method Detail

setFileName

public void setFileName(File filename)
Sets the name of the file to be uploaded.

Parameters:
filename -

getFileName

public File getFileName()

setCheckFileExists

public void setCheckFileExists(boolean b)
Indicates if WebTest should verify that the file to upload exists.

Parameters:
b - the new value

isCheckFileExists

public boolean isCheckFileExists()

findForm

protected com.gargoylesoftware.htmlunit.html.HtmlForm findForm()
Description copied from class: AbstractSetFieldStep
Finds the relevant form.

Specified by:
findForm in class AbstractSetFieldStep
Returns:
The found form.

keepField

protected boolean keepField(com.gargoylesoftware.htmlunit.html.HtmlElement elt)
Description copied from class: AbstractSetFieldStep
Called by AbstractSetFieldStep.findFields(com.gargoylesoftware.htmlunit.html.HtmlForm) to filter out elements with the correct name but not matching some other selection criteria.

Overrides:
keepField in class AbstractSetFieldStep
Parameters:
elt - One of the elements with the correct name.
Returns:
True if the element is accepted.

setField

protected void setField(com.gargoylesoftware.htmlunit.html.HtmlElement element)
                 throws IOException
Description copied from class: AbstractSetFieldStep
Sets a field according to the step. It is up to the step's implementation to decide how to set the step.

Specified by:
setField in class AbstractSetFieldStep
Parameters:
element - The field to set.
Throws:
IOException

verifyParameters

protected void verifyParameters()
Description copied from class: Step
Called to let the step's implementation validate its parameters. The method is called after parameter extensions but before Step.doExecute(). This implementation does nothing, overwrite as needed.

Overrides:
verifyParameters in class AbstractSetFieldStep

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