protected boolean setInputValue()

in module/geb-core/src/main/groovy/geb/navigator/DefaultNavigator.groovy [929:961]


    protected boolean setInputValue(WebElement input, String tagName, value, boolean suppressStaleElementException) {
        boolean valueSet = false
        try {
            def type = input.getAttribute("type")
            if (tagName == "select") {
                setSelectValue(input, value)
                valueSet = true
            } else if (type == "checkbox") {
                valueSet = setCheckboxValue(input, value)
            } else if (type == "radio") {
                if (getValue(input) == value.toString() || labelFor(input) == value.toString()) {
                    input.click()
                    valueSet = true
                }
            } else if (type == "file") {
                input.sendKeys value as String
                valueSet = true
            } else if (type in ["color", "date", "datetime-local", "time", "range", "month", "week"]) {
                browser.js.exec(input, value as String, 'arguments[0].setAttribute("value", arguments[1]);')
                valueSet = true
            } else {
                input.clear()
                input.sendKeys value as String
                valueSet = true
            }
        } catch (StaleElementReferenceException e) {
            if (!suppressStaleElementException) {
                throw e
            }
        } finally {
            valueSet
        }
    }