Package com.crawljax.forms
Class FormHandler
- java.lang.Object
-
- com.crawljax.forms.FormHandler
-
- Direct Known Subclasses:
TrainingFormHandler
public class FormHandler extends Object
Handles form values and fills in the form input elements with random values of the defined values.
-
-
Field Summary
Fields Modifier and Type Field Description protected EmbeddedBrowserbrowserprotected FormInputValueHelperformInputValueHelperprivate static org.slf4j.LoggerLOGGERstatic intRANDOM_STRING_LENGTH
-
Constructor Summary
Constructors Constructor Description FormHandler(EmbeddedBrowser browser, CrawlRules config)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<CandidateElement>getCandidateElementsForInputs(Element sourceElement, EventableCondition eventableCondition)List<FormInput>getFormInputs()private List<Node>getInputElements(Document dom)private voidhandleCheckBoxes(FormInput input)List<FormInput>handleFormElements(List<FormInput> formInputs)Fills in form/input elements.private voidhandleHidden(FormInput input)Enter information into the hidden input field.private voidhandleRadioSwitches(FormInput input)private voidhandleSelectBoxes(FormInput input)private voidhandleText(FormInput input)private voidresetCheckBoxes(FormInput input)voidresetFormInputs(List<FormInput> formInputs)protected voidresetInputElementValue(Node element, FormInput input)private voidresetRadioSwitches(FormInput input)private voidresetSelectBoxes(FormInput input)private voidresetText(FormInput input)Clear the input for given input textprotected voidsetInputElementValue(Node element, FormInput input)Fills in the element with the InputValues for input
-
-
-
Field Detail
-
RANDOM_STRING_LENGTH
public static final int RANDOM_STRING_LENGTH
- See Also:
- Constant Field Values
-
LOGGER
private static final org.slf4j.Logger LOGGER
-
browser
protected final EmbeddedBrowser browser
-
formInputValueHelper
protected final FormInputValueHelper formInputValueHelper
-
-
Constructor Detail
-
FormHandler
@Inject public FormHandler(EmbeddedBrowser browser, CrawlRules config)
-
-
Method Detail
-
setInputElementValue
protected void setInputElementValue(Node element, FormInput input)
Fills in the element with the InputValues for input- Parameters:
element- the node elementinput- the input data
-
handleCheckBoxes
private void handleCheckBoxes(FormInput input)
-
resetRadioSwitches
private void resetRadioSwitches(FormInput input)
-
handleRadioSwitches
private void handleRadioSwitches(FormInput input)
-
resetSelectBoxes
private void resetSelectBoxes(FormInput input)
-
handleSelectBoxes
private void handleSelectBoxes(FormInput input)
-
resetText
private void resetText(FormInput input)
Clear the input for given input text- Parameters:
input-
-
handleText
private void handleText(FormInput input)
-
handleHidden
private void handleHidden(FormInput input)
Enter information into the hidden input field.- Parameters:
input- The input to enter into the hidden field.
-
getInputElements
private List<Node> getInputElements(Document dom)
- Returns:
- all input element in dom
-
resetCheckBoxes
private void resetCheckBoxes(FormInput input)
-
handleFormElements
public List<FormInput> handleFormElements(List<FormInput> formInputs)
Fills in form/input elements.- Parameters:
formInputs- form input list.- Returns:
-
getCandidateElementsForInputs
public List<CandidateElement> getCandidateElementsForInputs(Element sourceElement, EventableCondition eventableCondition)
- Parameters:
sourceElement- the form elementeventableCondition- the belonging eventable condition for sourceElement- Returns:
- a list with Candidate elements for the inputs.
-
-