diff --git a/src/Element/NodeElement.php b/src/Element/NodeElement.php index bbb857332..e7dffeda3 100644 --- a/src/Element/NodeElement.php +++ b/src/Element/NodeElement.php @@ -237,6 +237,21 @@ public function selectOption($option, $multiple = false) $this->getDriver()->selectOption($this->getXpath(), $opt->getValue(), $multiple); } + /** + * Returns that the option is in the element or not. + * + * @param string $option + * @return Boolean + */ + public function hasOption($option) + { + if ('select' !== $this->getTagName()) { + throw new ExpectationException("Element should be a select element.", $this->getDriver()); + } + + return $this->find('named', array('option', $option)) !== null; + } + /** * Checks whether current node is selected if it's a option field. *