Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/Element/NodeElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down