code: def find_field_by_value(browser, field_type, name):
      
      xpath = field_xpath(field_type, 'value') % string_literal(name)
      elems = ElementSelector(
          browser,
          xpath=str(xpath),
          filter_displayed=True,
          filter_enabled=True,
      )
  
      # sort by shortest first (most closely matching)
      if field_type in ('button-element', 'button-role'):
          elems = sorted(elems, key=lambda elem: len(elem.text))
      else:
          elems = sorted(elems,
                         key=lambda elem: len(elem.get_attribute('value')))
  
      if elems:
          elems = [elems[0]]
  
      return ElementSelector(browser, elements=elems)
docs: Locate the control input with the given ``value``. Useful for buttons.
  
      :param browser: ``world.browser``
      :param string field_type: a field type (i.e. `button`)
      :param string name: ``value`` attribute
  
      Returns: an :class:`ElementSelector`