public function unselectOption($select, $option) { $el = $this->findField($select); $wdSelect = new \WebDriverSelect($el); if (!is_array($option)) { $option = array($option); } $matched = false; foreach ($option as $opt) { try { $wdSelect->deselectByVisibleText($opt); $matched = true; } catch (\NoSuchElementException $e) { } try { $wdSelect->deselectByValue($opt); $matched = true; } catch (\NoSuchElementException $e) { } } if ($matched) { return; } throw new ElementNotFound(json_encode($option), "Option inside {$select} matched by name or value"); }