Prose\FromBrowser::getValue PHP Метод

getValue() публичный Метод

public getValue ( )
    public function getValue()
    {
        $action = function ($element, $elementName, $elementDesc) {
            $log = usingLog()->startAction("retrieve the value of the {$elementDesc} '{$elementName}'");
            // is this a select box?
            switch ($element->name()) {
                case 'select':
                    // get the option that is selected
                    try {
                        $option = $element->getElement('xpath', 'option[@selected]');
                        $log->endAction("value is: " . $option->text());
                        return $option->text();
                    } catch (Exception $e) {
                        // return the top option from the list
                        $option = $element->getElement('xpath', 'option[1]');
                        $log->endAction("value is: " . $option->text());
                        return $option->text();
                    }
                case 'input':
                    $log->endAction("value is: " . $element->attribute("value"));
                    return $element->attribute("value");
                default:
                    $log->endAction("value is: " . $element->text());
                    return $element->text();
            }
        };
        return new SingleElementAction($action, "getValue", $this->getTopElement());
    }