/**
  * Returns a crawler instance for the current source.
  *
  * @return Crawler
  */
 private function getCrawler()
 {
     $content = '<html>' . $this->browser->getHtmlSource() . '</html>';
     $contentType = null;
     // get content-type from meta tag
     if (preg_match('/\\<meta[^\\>]+charset *= *["\']?([a-zA-Z\\-0-9]+)/i', $content, $matches)) {
         $contentType = 'text/html;charset=' . $matches[1];
     }
     $crawler = new Crawler();
     $crawler->addContent($content, $contentType);
     return $crawler;
 }
Esempio n. 2
0
 /**
  * Returns crawler instance (got from client).
  *
  * @return  Symfony\Component\DomCrawler\Crawler
  *
  * @throws  Behat\Mink\Exception\DriverException    if can't init crawler (no page is opened)
  */
 private function getCrawler()
 {
     return new \Symfony\Component\DomCrawler\Crawler('<html>' . $this->browser->getHtmlSource() . '</html>');
 }