Click on the given label.

    On a correctly set up form this will highlight the appropriate field.
512264
def click_on_label(self, label):
    

    elem = ElementSelector(
        world.browser,
        str('//label[normalize-space(text())=%s]' % string_literal(label)),
        filter_displayed=True,
    )
    if not elem:
        raise AssertionError(
            "Cannot find a label with text '{}'.".format(label))
    elem.click()
912867
protected JLabel createLabelFor(String fieldName, JComponent component) {
		JLabel label = getComponentFactory().createLabel("");
		getFormModel().getFieldFace(fieldName).configure(label);
		label.setLabelFor(component);

		FormComponentInterceptor interceptor = getFormComponentInterceptor();
		if (interceptor != null) {
			interceptor.processLabel(fieldName, label);
		}

		return label;
	}
438918
void bindField(AbstractField<?> field, String property) {

        m_group.bind(field, property);

        field.setCaption(CmsVaadinUtils.getMessageText("label." + property));
        field.setDescription(CmsVaadinUtils.getMessageText("label." + property + ".help"));
    }
824653
def describe_form(label, fields):
    
    try:
        app_name, model_name = label.split('.')[-2:]
    except (IndexError, ValueError):
        raise CommandError("Need application and model name in the form: appname.model")
    model = apps.get_model(app_name, model_name)

    opts = model._meta
    field_list = []
    for f in opts.fields + opts.many_to_many:
        if not f.editable:
            continue
        if fields and f.name not in fields:
            continue
        formfield = f.formfield()
        if '__dict__' not in dir(formfield):
            continue
        attrs = {}
        valid_fields = ['required', 'initial', 'max_length', 'min_length', 'max_value', 'min_value', 'max_digits', 'decimal_places', 'choices', 'help_text', 'label']
        for k, v in formfield.__dict__.items():
            if k in valid_fields and v is not None:
                # ignore defaults, to minimize verbosity
                if k == 'required' and v:
                    continue
                if k == 'help_text' and not v:
                    continue
                if k == 'widget':
                    attrs[k] = v.__class__
                elif k in ['help_text', 'label']:
                    attrs[k] = str(force_text(v).strip())
                else:
                    attrs[k] = v

        params = ', '.join(['%s=%r' % (k, v) for k, v in sorted(attrs.items())])
        field_list.append('    %(field_name)s = forms.%(field_type)s(%(params)s)' % {
            'field_name': f.name,
            'field_type': formfield.__class__.__name__,
            'params': params
        })
    return '''
from django import forms
from %(app_name)s.models import %(object_name)s

class %(object_name)sForm(forms.Form):
%(field_list)s
''' % {'app_name': app_name, 'object_name': opts.object_name, 'field_list': '\n'.join(field_list)}
820830
def find_field_by_label(browser, field, label):
    

    return XPathSelector(browser,
                         field_xpath(field, 'id', escape=False) %
                         u'//label[contains(., "{0}")]/@for'.format(label))
963575
public void setLabel(String label) {
        this.label.setText(label);

        if (!getPlaceholder().isEmpty()) {
            this.label.setStyleName(CssName.ACTIVE);
        }
    }
1205770
def with_label(label)
      if label.is_a?(Regexp)
        lights.find { |l| l.label(fetch: false) =~ label }
      else
        lights.find { |l| l.label(fetch: false) == label }
      end
    end
690103
def get_label(self):
        
        if self.label is None:
            self.label = self.get_field('label')
        return self.label
871478
def render_field_and_label(
    field, label, field_class="", label_for=None, label_class="", layout="", **kwargs
):
    
    if layout == "horizontal":
        if not label_class:
            label_class = get_bootstrap_setting("horizontal_label_class")
        if not field_class:
            field_class = get_bootstrap_setting("horizontal_field_class")
        if not label:
            label = mark_safe("&#160;")
        label_class = add_css_class(label_class, "control-label")
    html = field
    if field_class:
        html = '<div class="{klass}">{html}</div>'.format(klass=field_class, html=html)
    if label:
        html = render_label(label, label_for=label_for, label_class=label_class) + html
    return html
701285
private void labelIndicatorMouseEntered(MouseEvent e) {
        // Skip this function if the settings have not been applied.
        if (settings == null) {
            return;
        }
        JLabel label = ((JLabel) e.getSource());
        // Do not highlight the today label if today is vetoed.
        if (label == labelSetDateToToday) {
            DateVetoPolicy vetoPolicy = settings.getVetoPolicy();
            boolean todayIsVetoed = InternalUtilities.isDateVetoed(vetoPolicy, LocalDate.now());
            if (todayIsVetoed) {
                return;
            }
        }
        // Do not highlight the month label if the month menu is disabled.
        if ((label == labelMonth) && (settings.getEnableMonthMenu() == false)) {
            return;
        }
        // Do not highlight the year label if the year menu is disabled.
        if ((label == labelYear) && (settings.getEnableYearMenu() == false)) {
            return;
        }
        // Highlight the label.
        label.setBackground(new Color(184, 207, 229));
        label.setBorder(new CompoundBorder(
            new LineBorder(Color.GRAY), labelIndicatorEmptyBorder));
    }
1172861
function checklistBox(selection, label) {
  // TODO: scroll
  selection
      .classed('form-group', true)
      .classed('form-row', true)
      .classed('align-items-center', true);
  const formLabel = selection.append('label')
      .classed('col-form-label', true)
      .classed('col-form-label-sm', true)
      .classed('col-4', true)
      .text(label);
  formLabel.append('div')
      .call(badge.invalidFeedback);
  selection.append('ul')
      .classed('form-control', true)
      .classed('form-control-sm', true)
      .classed('col-8', true);
}
975298
protected function setupLabel()
    {
        if ($this->getOption('label') !== null) {
            return;
        }

        if ($template = $this->parent->getTranslationTemplate()) {
            $label = str_replace(
                ['{name}', '{type}'],
                [$this->getRealName(), 'label'],
                $template
            );
        } elseif ($langName = $this->parent->getLanguageName()) {
            $label = sprintf('%s.%s', $langName, $this->getRealName());
        } else {
            $label = $this->getRealName();
        }

        $this->setOption('label', $this->formHelper->formatLabel($label));
    }
239971
function(e) {
        var select = $(e.target),
            options = select.find('option'),
            opts = this.options,
            selected = [],
            label = [],
            self = this;

        // Fetch label from selected option
        options.each(function() {
            if (this.selected) {
                selected.push( this );
                label.push( self.readValue(this, opts.getOptionLabel) || this.textContent );
            }
        });

        // Reformat label if needed
        if (this.multiple) {
            var title = this.readValue(select, opts.getDefaultLabel),
                format = opts.multipleFormat,
                count = label.length;

            // Use default title if nothing selected
            if (!label.length && title) {
                label = title;

                // Display a counter for label
            } else if (format === 'count') {
                label = opts.countMessage
                    .replace('{count}', count)
                    .replace('{total}', options.length);

                // Display options as a list for label
            } else if (format === 'list') {
                var limit = opts.listLimit;

                label = label.splice(0, limit).join(', ');

                if (limit < count) {
                    label += ' ...';
                }
            }
        } else {
            label = label.join(', ');
        }

        // Set the label
        select.parent()
            .find(this.ns('label', 'select'))
            .text(label);

        this.fireEvent('change', [select.val(), selected]);
    }
291458
def set_label(self):
		
		if not self.field.label or self.attrs.get("_no_label"):
			return

		self.values["label"] = format_html(
			LABEL_TEMPLATE, self.field.html_name, mark_safe(self.field.label)
		)
821263
function colorRangeBox(selection, label) {
  selection
      .classed('form-row', true)
      .classed('form-group', true)
      .classed('align-items-center', true);
  selection.append('div')
      .classed('col-form-label', true)
      .classed('col-form-label-sm', true)
      .text(label);

  const minBox = selection.append('div');
  minBox.append('label').text('min');
  minBox.append('input').classed('min', true);

  const midBox = selection.append('div');
  midBox.append('label').text('mid');
  midBox.append('input').classed('mid', true);

  const maxBox = selection.append('div');
  maxBox.append('label').text('max');
  maxBox.append('input').classed('max', true);

  selection.on('change', () => {
    // avoid update by mousemove on the colorpicker
    d3.event.stopPropagation();
  });

  selection.selectAll('div')
      .classed('form-group', true)
      .classed('col-3', true)
      .classed('mb-0', true);

  selection.selectAll('label')
      .classed('col-form-label', true)
      .classed('col-form-label-sm', true)
      .classed('py-0', true);

  selection.selectAll('input')
      .classed('form-control', true)
      .classed('form-control-sm', true)
      .attr('type', 'color');
}
819112
private void generateLabel() {

        HTML labelWidget = new HTML("<div class=\"" + formCss().label() + "\">" + m_label + "</div>");
        addLabelHoverHandler(labelWidget);
        m_widgetHolder.add(labelWidget);
    }
1369001
def _label(self, line):
        '''

        '''
        label = self._setup('LABEL', line)
        self.labels += [ label ]