Exemplo n.º 1
0
 /**
  * @return string
  * @throws WebDriverException
  */
 public function getText()
 {
     try {
         return $this->element->getText();
     } catch (WebDriverException $exception) {
         $this->dispatchOnException($exception);
     }
 }
 /**
  * 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 . '>';
 }
Exemplo n.º 3
0
 public function getBreadCrumbText()
 {
     $this->extract();
     $text = preg_replace('/\\s+/', ' ', $this->element->getText());
     return $text;
 }