public function selectOption($option, $multiple = false)
    {
        if ('select' !== $this->getTagName()) {
            $this->getDriver()->selectOption($this->getXpath(), $option, $multiple);

            return;
        }

        $opt = $this->find('named', array('option', $option));

        if (null === $opt) {
            throw new ElementNotFoundException($this->getDriver(), 'select option', 'value|text', $option);
        }

        $this->getDriver()->selectOption($this->getXpath(), $opt->getValue(), $multiple);
    }
public function selectOption($option, $multiple = false)
    {
        if ('select' !== $this->getTagName()) {
            $this->getDriver()->selectOption($this->getXpath(), $option, $multiple);

            return;
        }

        $opt = $this->find('named', array('option', $option));

        if (null === $opt) {
            throw new ElementNotFoundException($this->getDriver(), 'select option', 'value|text', $option);
        }

        $this->getDriver()->selectOption($this->getXpath(), $opt->getValue(), $multiple);
    }
public function selectOption ( $ option , $ multiple = false ) { if ( 'select' !== $ this -> getTagName ( ) ) { $ this -> getDriver ( ) -> selectOption ( $ this -> getXpath ( ) , $ option , $ multiple ) ; return ; } $ opt = $ this -> find ( 'named' , array ( 'option' , $ option ) ) ; if ( null === $ opt ) { throw new ElementNotFoundException ( $ this -> getDriver ( ) , 'select option' , 'value|text' , $ option ) ; } $ this -> getDriver ( ) -> selectOption ( $ this -> getXpath ( ) , $ opt -> getValue ( ) , $ multiple ) ; }
Selects specified option for select field or specified radio button in the group.

If the current node is a select box, this selects the option found by its value or
its text.
If the current node is a radio button, this selects the radio button with the given
value in the radio button group of the current node.

Calling this method on any other elements is not allowed.

@param string  $option
@param Boolean $multiple whether the option should be added to the selection for multiple selects

@throws ElementNotFoundException when the option is not found in the select box
Selects specified option for select field or specified radio button in the group .