Returns selected option label

@param string $sSelector

@return null|string
353507
public function getSelectedIndex($sSelector)
    {
        $oSelect = $this->getElementLazy($sSelector);
        $sValue = $oSelect->getValue();
        $oOptions = $oSelect->findAll('css', "option");
        foreach ($oOptions as $iKey => $oOption) {
            if ($oOption->getValue() == $sValue) {
                return $iKey;
            }
        }
        return $oSelect->getText();
    }
889502
public static function parseSelector($text){
		$text = preg_replace('/(\>|\+|~)\s+/is', '$1', $text);
		
		$selector	= null;
		
		foreach(preg_split('/\s+/', $text, -1, PREG_SPLIT_NO_EMPTY) as $part){
			if(!preg_match('/^([\>\+~]?)([^ >\+~]+)$/is', $part, $matches)) throw new \Exception("Invalid selector part '$part'");
			
			$selector = $selector ? $selector->add($matches[1] ? $matches[1] : false) : Selector::create();
			
			$offset = 0;
			
			$subtext = $matches[2];
			while($offset < strlen($subtext)){
				if(!preg_match('/^([\.:#]?)((:?[a-z0-9\-]|\*)+)/is', substr($subtext, $offset), $matches)) throw new \Exception("Invalid property at '".substr($text, $offset, 20)."'");
				
				switch($matches[1]){
					case '': $selector->setTagName($matches[2]); break;
					case '#': $selector->setIdentification($matches[2]); break;
					case '.': $selector->addClass($matches[2]); break;
					case ':': $selector->addPseudo($matches[2]); break;
					default: throw new \Exception("Knonwn type '".$matches[1]."'");
				}

				$offset+= strlen($matches[0]);
			}
		}

		return $selector->get();
	}
912443
public function label() {
		$output = null;
		if ( ! empty( $this->struct['label'] ) ) {
			$output .= '<span class="uix-text">' . esc_html( $this->struct['label'] ) . '</span>';
		}

		return $output;
	}
328699
public function getFirstSelectedOption()
	{
		foreach ( $this->getOptions() as $option ) {
			if ( $option->isSelected() ) {
				return $option;
			}
		}

		throw new SelectException('No options are selected', SelectException::TYPE_NOT_SELECTED);
	}
651429
private ElementDescription chooseElement(List<ElementDescription> elements) {
		final ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(),
				new LabelProvider());
		dialog.setElements(elements.toArray());
		dialog.setTitle(MessageFormat.format(Messages.AbstractSarlScriptInteractiveSelector_3, getElementLabel()));
		dialog.setMessage(MessageFormat.format(Messages.AbstractSarlScriptInteractiveSelector_3,
				getElementLongLabel()));
		dialog.setMultipleSelection(false);
		final int result = dialog.open();
		if (result == Window.OK) {
			return (ElementDescription) dialog.getFirstResult();
		}
		return null;
	}
331977
private function getRememberDirectiveSelector() {
		if (isset($_COOKIE[$this->rememberCookieName])) {
			$selectorAndToken = \explode(self::COOKIE_CONTENT_SEPARATOR, $_COOKIE[$this->rememberCookieName], 2);

			return $selectorAndToken[0];
		}
		else {
			return null;
		}
	}
114640
protected function _option($value, $selected = false, $class = '', $label = '')
    {
        if ($selected === true) {
            $selected = ' selected="selected"';
        }

        $option = '<option value="' . $value . '" class="' . $class .  '"' . $selected .'>' .
                $this->_translate($label) .
            '</option>';

        return $option;
    }
146515
public function getCurrentSelectionName()
    {
        $name = $this->getDefaultSelectionName();

        if ($this->getCurrentContainerName()) {
            $name = $this->getCurrentContainerLabel();
            if ($this->getCurrentStoreName()) {
                $name .= " > " . $this->getCurrentStoreName();
            }
        }

        return $name;
    }
283954
public function outputElement() : string
    {
        $this->selected = $this->getValue();

        $return = '';
        foreach ($this->options as $val=>$txt) {
            if (in_array($val, $this->hidden)) break;
            $disabled = (in_array($val, $this->disabled)) ? ' disabled="disabled"' : '';
            $selected = ($this->selected == $val) ? ' checked' : '';
            $return .= '<input type="radio" name="'.$this->attributes['name'].'" value="' . $val . '" ' . $disabled . $selected . ' /> ' . $txt . "<br>\n";
        }

        return $return;
    }
221411
protected function getLabel()
	{
		if (isset($this->labelOptions['class']))
			$this->labelOptions['class'] .= ' control-label';
		else
			$this->labelOptions['class'] = 'control-label';

		return parent::getLabel();
	}
442372
public static function selectOptions($optionsArray, $selected = NULL) {
    $ret = array();
    foreach ($optionsArray as $value => $label) {
      if ($label instanceof HTMLTag) {
        $tag = $label;
        
        if ($tag->getAttribute('value') === $selected)
          $tag->setAttribute('selected','selected');

      } else {
        /* Interface Form Item */
        if($label instanceof \Psc\Form\Item) {
          $item = $label;
          $label = $item->getFormLabel();
          $value = $item->getFormValue();
        }
        
        $tag = static::tag('option',self::esc((string) $label),array('value'=>$value));
        if ($value === $selected)
          $tag->setAttribute('selected','selected');
      }
      
      $ret[] = $tag;
    }
    return $ret;
  }
1304435
public function click($sSelector)
    {
        try {
            $this->getElementLazy($sSelector)->click();
        } catch (ElementException $e) {
            sleep(1);
            $this->getElementLazy($sSelector)->click();
        }
    }
373392
public function getValue($sSelector)
    {
        $element = $this->getElementLazy($sSelector);
        $mValue = $this->_getValue($element->getXpath());

        try {
            $sType = $element->getAttribute('type');
        } catch (InvalidArgumentException $e) {
            sleep(1);
            $sType = $element->getAttribute('type');
        }
        if ($sType == 'checkbox') {
            $mValue = $mValue ? 'on' : 'off';
        }

        return trim($mValue);
    }
523751
public function getLabelData($index = null) {
		if($index === null)
			return $this->labelData;
		else
			return $this->labelData[$index];
	}
1216256
protected function _getSearchSelect($sSearchString)
    {
        // check if it has string at all
        if (!$sSearchString || !str_replace(' ', '', $sSearchString)) {
            return '';
        }

        $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
        $myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
        $sArticleTable = $this->getBaseObject()->getViewName();

        $aSearch = explode(' ', $sSearchString);

        $sSearch = ' and ( ';
        $blSep = false;

        // #723
        if ($myConfig->getConfigParam('blSearchUseAND')) {
            $sSearchSep = ' and ';
        } else {
            $sSearchSep = ' or ';
        }

        $aSearchCols = $myConfig->getConfigParam('aSearchCols');
        $myUtilsString = \OxidEsales\Eshop\Core\Registry::getUtilsString();
        foreach ($aSearch as $sSearchString) {
            if (!strlen($sSearchString)) {
                continue;
            }

            if ($blSep) {
                $sSearch .= $sSearchSep;
            }
            $blSep2 = false;
            $sSearch .= '( ';

            $sUml = $myUtilsString->prepareStrForSearch($sSearchString);
            foreach ($aSearchCols as $sField) {
                if ($blSep2) {
                    $sSearch .= ' or ';
                }

                // as long description now is on different table table must differ
                $sSearchTable = $this->getSearchTableName($sArticleTable, $sField);

                $sSearch .= $sSearchTable . '.' . $sField . ' like ' . $oDb->quote('%' . $sSearchString . '%') . ' ';
                if ($sUml) {
                    $sSearch .= ' or ' . $sSearchTable . '.' . $sField . ' like ' . $oDb->quote('%' . $sUml . '%');
                }
                $blSep2 = true;
            }
            $sSearch .= ' ) ';
            $blSep = true;
        }
        $sSearch .= ' ) ';

        return $sSearch;
    }
844272
protected function renderLabel(ElementInterface $element)
    {
        $labelPlugin = $this->getView()->plugin('sxb_form_control_label');
        $label       = $element->getLabel();

        if (null !== $label) {
            $label = $labelPlugin($label, $element->getName(), $element->getLabelAttributes());
        }

        return $label;
    }
1176890
private function getSelectorAsXpath(SelectorsHandler $selectorsHandler)
    {
        $selectorType = is_array($this->selector) ? key($this->selector) : 'css';
        $locator = is_array($this->selector) ? $this->selector[$selectorType] : $this->selector;

        return $selectorsHandler->selectorToXpath($selectorType, $locator);
    }