Assert the form input with label (recommended), name or id has given value.
421036
def input_has_value(self, field_name, value):
    
    text_field = find_any_field(world.browser,
                                DATE_FIELDS + TEXT_FIELDS,
                                field_name)
    if text_field is False:
        raise AssertionError(
            "Can not find a field named {!r}.".format(field_name))

    actual = text_field.get_attribute('value')
    if actual != value:
        raise AssertionError(
            "Field value expected to be {!r}, got {!r}.".format(
                value, actual))
1307505
def element_id_by_label(browser, label):
    """"""
    label = XPathSelector(browser,
                          unicode('//label[contains(., "%s")]' % label))
    if not label:
        return False
    return label.get_attribute('for')
1340566
public static function checkLabel( $label, $name, $id, $checked = false, $attribs = array() ) {
		return self::check( $name, $checked, array( 'id' => $id ) + $attribs ) .
			   '&#160;' .
			   self::label( $label, $id, $attribs );
	}
592833
def validate_search_input(self) -> bool:
        ""
        input = self._search_input
        if input.value == str(): input.layout = Layout(border="solid 2px red", height='auto')
        else:                    self._search_input.layout = Layout()
        return input.value != str()
1036212
def getLabel(self,form):
        """"""
        return specialInterpretValue(self.label,self.name,form=form)
637112
def _validate_label(self, label):
        """"""

        letter_pattern = compile("^[a-z]{1}$")
        number_pattern = compile("^[0]{1}$|^[1-9]{1,2}$")
        icon_pattern = compile("^[a-zA-Z ]{1,}$")

        if not match(letter_pattern, label)\
            and not match(number_pattern, label)\
                and not match(icon_pattern, label):
                    raise InvalidLabelError(
                        "{} is not a valid label".format(label)
                    )

        return label
1014308
def validate_element(self, value):
        
        # If value is str is it considered valid.  Satisfies "required=True".
        if isinstance(value, bytes):
            try:
                six.text_type(value, 'UTF-8')
            except UnicodeDecodeError as err:
                try:
                    _ = self.name
                except AttributeError:
                    validation_error = ValidationError(
                        'Field encountered non-UTF-8 string %r: %s' % (value,
                                                                       err))
                else:
                    validation_error = ValidationError(
                        'Field %s encountered non-UTF-8 string %r: %s' % (
                            self.name, value, err))
                    validation_error.field_name = self.name
                raise validation_error
        else:
            return super(StringField, self).validate_element(value)
        return value
440099
def assert_valid(self, instance, value=None):
        
        if value is None:
            value = instance._get(self.name)
        if (
                value is not None and
                not self.equal(value, self.validate(instance, value))
        ):
            message = 'Invalid value for property: {}: {}'.format(
                self.name, value
            )
            raise ValidationError(message, 'invalid', self.name, instance)
        return True
934434
def valid_input?(input)
      case @attributes[:type]
      when :boolean
        [true,false].include?(input)
      when :enum
        raise MissingValuesError unless @attributes[:values]
        raise InvalidValuesError unless @attributes[:values].class == Array
        @attributes[:values].include?(input)
      when :string
        format = @attributes[:format] || :anything
        Validator.valid_input?(format, input)
      when :number
        [Integer, Fixnum].include?(input.class)
      when :timestamp
        # TODO timestamp pending
        # raise PendingBranchError
        true
      else
        false
      end
    end
1199117
def assert_radio_selected(self, value):
    
    radio = find_field(world.browser, 'radio', value)
    assert radio, "Cannot find a '{}' radio button.".format(value)
    assert radio.is_selected(), "Radio button should be selected."
1309397
def validate_value(self, value):
        """"""
        super(ValuesListField, self).validate_value(value)

        if value is not None:
            if value not in self.selection_to_id_map:
                raise ValidationError(
                    self.record,
                    'Field "{}" invalid value "{}". Valid options: {}'.format(
                        self.name,
                        value,
                        ', '.join(self.selection_to_id_map.keys())
                    )
                )
1099905
public void validate(String input) throws Exception {
        Assert.assertFalse(input == null);
        Assert.assertFalse(input.trim().equals(""));
    }
992714
function isNotEmpty(value, message, id) {
    if (message === void 0) { message = ''; }
    if (id === void 0) { id = ''; }
    if (this.enabled &&
        ((typeof value === 'string' && value.length !== 0) ||
            (typeof value === 'number' && value !== 0))) {
        throw LogicException.throw(assertionTypes.IS_NOT_EMPTY, value, message, id);
    }
}
905402
def element_contains(self, element_id, value):
    

    elements = ElementSelector(
        world.browser,
        str('id("{id}")[contains(., "{value}")]'.format(
            id=element_id, value=value)),
        filter_displayed=True,
    )
    if not elements:
        raise AssertionError("Expected element not found.")
415628
function(form, options) {
      var values = {}
        , i
        , j
        , input
        , inputs
        , option
        , value;

      if (v.isJqueryElement(form)) {
        form = form[0];
      }

      if (!form) {
        return values;
      }

      options = options || {};

      inputs = form.querySelectorAll("input[name], textarea[name]");
      for (i = 0; i < inputs.length; ++i) {
        input = inputs.item(i);

        if (v.isDefined(input.getAttribute("data-ignored"))) {
          continue;
        }

        var name = input.name.replace(/\./g, "\\\\.");
        value = v.sanitizeFormValue(input.value, options);
        if (input.type === "number") {
          value = value ? +value : null;
        } else if (input.type === "checkbox") {
          if (input.attributes.value) {
            if (!input.checked) {
              value = values[name] || null;
            }
          } else {
            value = input.checked;
          }
        } else if (input.type === "radio") {
          if (!input.checked) {
            value = values[name] || null;
          }
        }
        values[name] = value;
      }

      inputs = form.querySelectorAll("select[name]");
      for (i = 0; i < inputs.length; ++i) {
        input = inputs.item(i);
        if (v.isDefined(input.getAttribute("data-ignored"))) {
          continue;
        }

        if (input.multiple) {
          value = [];
          for (j in input.options) {
            option = input.options[j];
             if (option && option.selected) {
              value.push(v.sanitizeFormValue(option.value, options));
            }
          }
        } else {
          var _val = typeof input.options[input.selectedIndex] !== 'undefined' ? input.options[input.selectedIndex].value : /* istanbul ignore next */ '';
          value = v.sanitizeFormValue(_val, options);
        }
        values[input.name] = value;
      }

      return values;
    }
859654
private InputValue getInputValue(FormInput input) {

		/* Get the DOM element from Selenium. */
		WebElement inputElement = browser.getWebElement(input.getIdentification());

		switch (input.getType()) {
			case TEXT:
			case PASSWORD:
			case HIDDEN:
			case SELECT:
			case TEXTAREA:
				return new InputValue(inputElement.getAttribute("value"));
			case RADIO:
			case CHECKBOX:
			default:
				String value = inputElement.getAttribute("value");
				Boolean checked = inputElement.isSelected();
				return new InputValue(value, checked);
		}

	}
827514
def _checkAttribs(self, strict):
        """"""
        if self.min:
            warning("Minimum value not allowed for boolean-type parameter " +
                    self.name, strict)
            self.min = None
        if self.max:
            if not self.prompt:
                warning("Maximum value not allowed for boolean-type parameter " +
                                self.name + " (probably missing comma)",
                                strict)
                # try to recover by assuming max string is prompt
                self.prompt = self.max
            else:
                warning("Maximum value not allowed for boolean-type parameter " +
                        self.name, strict)
            self.max = None
        if self.choice:
            warning("Choice values not allowed for boolean-type parameter " +
                    self.name, strict)
            self.choice = None