/** * @return string * @throws WebDriverException */ public function getTagName() { try { return $this->element->getTagName(); } catch (WebDriverException $exception) { $this->dispatchOnException($exception); } }
public function __construct(WebDriverElement $element) { $tag_name = $element->getTagName(); if ($tag_name !== 'select') { throw new UnexpectedTagNameException('select', $tag_name); } $this->element = $element; $value = $element->getAttribute('multiple'); $this->isMulti = $value === 'true'; }
/** * Returns the html of the expected element. * * @param WebDriverElement $element * * @return string */ private function _getClickingElementsHtml(WebDriverElement $element) { if ($element instanceof WebDriverElementNull || $this->isFailed()) { return $element; } $id = $element->getAttribute('id') !== '' ? $element->getAttribute('id') : null; $class = $element->getAttribute('class') !== '' ? $element->getAttribute('class') : null; $disabled = $element->getAttribute('disabled') !== '' ? $element->getAttribute('disabled') : null; $href = $element->getAttribute('href') !== '' ? $element->getAttribute('href') : null; $idValue = $id ? ' id="' . trim($id) . '"' : null; $classValue = $class ? ' class="' . trim($class) . '"' : null; $disabledValue = $disabled ? ' disabled' : null; $hrefValue = $href ? ' href="' . trim($href) . '"' : null; $tagName = $element->getTagName(); $tagText = $element->getText(); return '<' . $tagName . $idValue . $classValue . $disabledValue . $hrefValue . '>' . $tagText . '</' . $tagName . '>'; }