eventManager->dispatchEvent(['set_value'], [__METHOD__, $this->getAbsoluteSelector()]); $this->find($this->toggle)->click(); $this->deselectAll(); $values = is_array($values) ? $values : [$values]; foreach ($values as $value) { $this->find( sprintf($this->optionByValue, $this->escapeQuotes($value)), Locator::SELECTOR_XPATH )->click(); } $this->find($this->toggle)->click(); } /** * Get values. * * @return array */ public function getValue() { $this->eventManager->dispatchEvent(['get_value'], [__METHOD__, $this->getAbsoluteSelector()]); $values = []; $this->find($this->toggle)->click(); $options = $this->getElements($this->selectedValue); foreach ($options as $option) { $values[] = $option->getText(); } $this->find($this->toggle)->click(); return $values; } /** * Deselect all options in the element. * * @return void */ public function deselectAll() { $options = $this->getElements($this->selectedValue); /** @var SimpleElement $option */ foreach ($options as $option) { $option->click(); } } }