/** * Get the value of form element. * * @return string */ public function getValue() { $selectedLabel = trim(parent::getValue()); $element = $this->find(sprintf($this->website, $selectedLabel), Locator::SELECTOR_XPATH); $value = trim($element->getAttribute('label')); $element = $this->find(sprintf($this->storeGroup, $selectedLabel), Locator::SELECTOR_XPATH); $value .= '/' . trim($element->getAttribute('label'), chr(0xc2) . chr(0xa0)); $value .= '/' . $selectedLabel; return $value; }
/** * Get the value of form element. * * @return string * @throws \Exception */ public function getValue() { $this->eventManager->dispatchEvent(['get_value'], [(string) $this->getAbsoluteSelector()]); $selectedLabel = parent::getValue(); if ($selectedLabel == '') { throw new \Exception('Selected value has not been found in optgroup select.'); } $element = $this->find(sprintf($this->optGroup, $selectedLabel), Locator::SELECTOR_XPATH); $value = trim($element->getAttribute('label'), chr(0xc2) . chr(0xa0)); $value .= '/' . $selectedLabel; return $value; }