use of ru.yandex.qatools.htmlelements.element.CheckBox in project page-factory-2 by sbtqa.
the class HTMLPage method setCheckBox.
/**
* Find web element with corresponding title, if it is a check box, select
* it If it's a WebElement instance, check whether it is already selected,
* and click if it's not Add corresponding parameter to allure report
*
* @param elementTitle WebElement that is supposed to represent checkbox
*
* @throws PageException if page was not initialized, or required element
* couldn't be found
*/
@ActionTitle("ru.sbtqa.tag.pagefactory.select.checkBox")
public void setCheckBox(String elementTitle) throws PageException {
WebElement targetElement = getElementByTitle(this, elementTitle);
if (targetElement.getClass().isAssignableFrom(CheckBox.class)) {
((CheckBox) targetElement).select();
} else {
setCheckBoxState(targetElement, true);
}
ParamsHelper.addParam(elementTitle, " is checked");
}
use of ru.yandex.qatools.htmlelements.element.CheckBox in project page-factory-2 by sbtqa.
the class HtmlStepsImpl method setFormElementValue.
public T setFormElementValue(String key, String value) {
WebElement element = getElement(key);
if (element instanceof TextInput) {
element.clear();
element.sendKeys(value);
} else {
if (element instanceof SelectValue) {
((SelectValue) element).selectByValue(value);
} else {
if (element instanceof CheckBox) {
((CheckBox) element).set(Boolean.valueOf(value));
} else {
throw new AutotestError("Incorrect element type: " + key);
}
}
}
return (T) this;
}
Aggregations