/**
  * Returns exception message with additional context info.
  *
  * @return string
  */
 public function __toString()
 {
     try {
         $pageText = $this->trimString($this->element->getHtml());
         $string = sprintf("%s\n\n%s%s", $this->getMessage(), $this->getResponseInfo(), $this->pipeString($pageText . "\n"));
     } catch (\Exception $e) {
         return $this->getMessage();
     }
     return $string;
 }
Пример #2
0
 /**
  * Extracts and returns the label NodeElement, identified by $field content and $element
  *
  * @param string  $field
  * @param Element $element
  *
  * @return NodeElement
  */
 protected function extractLabelElement($field, $element)
 {
     $subLabelContent = null;
     $labelContent = $field;
     if (strstr($field, 'USD') || strstr($field, 'EUR')) {
         if (false !== strpos($field, ' ')) {
             list($subLabelContent, $labelContent) = explode(' ', $field);
         }
     }
     if ($element) {
         $label = $this->spin(function () use($element, $labelContent) {
             return $element->find('css', sprintf('label:contains("%s")', $labelContent));
         }, 10, sprintf('unable to find label %s in element : %s', $labelContent, $element->getHtml()));
     } else {
         $label = $this->spin(function () use($labelContent) {
             return $this->find('css', sprintf('label:contains("%s")', $labelContent));
         }, 10, sprintf('unable to find label %s', $labelContent));
     }
     if (!$label) {
         $label = new \StdClass();
     }
     $label->labelContent = $labelContent;
     $label->subLabelContent = $subLabelContent;
     return $label;
 }
Пример #3
0
 /**
  * Returns exception message with additional context info.
  *
  * @return  string
  */
 public function __toString()
 {
     return $this->getMessage() . "\n\n" . $this->getResponseInfo() . $this->pipeString($this->trimString($this->element->getHtml()) . "\n");
 }