Set<InputValue> values = new HashSet<InputValue>();
// create some random value
if (input.getType().toLowerCase().startsWith("text")) {
values.add(new InputValue(new RandomInputValueGenerator()
.getRandomString(FormHandler.RANDOM_STRING_LENGTH), true));
} else if (input.getType().equalsIgnoreCase("checkbox")
|| input.getType().equalsIgnoreCase("radio") && !webElement.isSelected()) {
if (new RandomInputValueGenerator().getCheck()) {
values.add(new InputValue("1", true));
} else {
values.add(new InputValue("0", false));
}
} else if (input.getType().equalsIgnoreCase("select")) {
try {
Select select = new Select(webElement);
WebElement option =
(WebElement) new RandomInputValueGenerator().getRandomOption(select
.getOptions());
values.add(new InputValue(option.getText(), true));
} catch (WebDriverException e) {
throwIfConnectionException(e);
return null;
}
}