Search in sources :

Example 1 with TextInput

use of ru.yandex.qatools.htmlelements.element.TextInput 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;
}
Also used : AutotestError(ru.sbtqa.tag.qautils.errors.AutotestError) CheckBox(ru.yandex.qatools.htmlelements.element.CheckBox) WebElement(org.openqa.selenium.WebElement) HtmlElementUtils.getWebElement(ru.sbtqa.tag.pagefactory.utils.HtmlElementUtils.getWebElement) TextInput(ru.yandex.qatools.htmlelements.element.TextInput) SelectValue(ru.sbtqa.tag.pagefactory.elements.select.SelectValue)

Aggregations

WebElement (org.openqa.selenium.WebElement)1 SelectValue (ru.sbtqa.tag.pagefactory.elements.select.SelectValue)1 HtmlElementUtils.getWebElement (ru.sbtqa.tag.pagefactory.utils.HtmlElementUtils.getWebElement)1 AutotestError (ru.sbtqa.tag.qautils.errors.AutotestError)1 CheckBox (ru.yandex.qatools.htmlelements.element.CheckBox)1 TextInput (ru.yandex.qatools.htmlelements.element.TextInput)1