public function save_driver_content(\Openbuildings\Spiderling\Driver $driver, $filename, $title)
    {
        $content = $driver->content();

        foreach (['href', 'action', 'src'] as $attribute) {
            $content = self::to_absolute_attribute($attribute, $content, $this->_base_url);
        }

        $testview = self::render_file(__DIR__.'/../assets/error-page.php', [
            'url' => $driver->current_url(),
            'title' => $title,
            'javascript_errors' => $driver->javascript_errors(),
            'javascript_messages' => $driver->javascript_messages(),
        ]);

        $page_content = str_replace('</body>', $testview.'</body>', $content);

        file_put_contents($this->_directory."/$filename.html", $page_content);

        try {
            $driver->screenshot($this->_directory."/$filename.png");
        } catch (\Openbuildings\Spiderling\Exception_Notimplemented $e) {
            // Ignore not generating the screenshot if the driver doesn't support it
        }
    }
public function save_driver_content(\Openbuildings\Spiderling\Driver $driver, $filename, $title)
    {
        $content = $driver->content();

        foreach (['href', 'action', 'src'] as $attribute) {
            $content = self::to_absolute_attribute($attribute, $content, $this->_base_url);
        }

        $testview = self::render_file(__DIR__.'/../assets/error-page.php', [
            'url' => $driver->current_url(),
            'title' => $title,
            'javascript_errors' => $driver->javascript_errors(),
            'javascript_messages' => $driver->javascript_messages(),
        ]);

        $page_content = str_replace('</body>', $testview.'</body>', $content);

        file_put_contents($this->_directory."/$filename.html", $page_content);

        try {
            $driver->screenshot($this->_directory."/$filename.png");
        } catch (\Openbuildings\Spiderling\Exception_Notimplemented $e) {
            // Ignore not generating the screenshot if the driver doesn't support it
        }
    }
public function save_driver_content ( \ Openbuildings \ Spiderling \ Driver $ driver , $ filename , $ title ) { $ content = $ driver -> content ( ) ; foreach ( [ 'href' , 'action' , 'src' ] as $ attribute ) { $ content = self :: to_absolute_attribute ( $ attribute , $ content , $ this -> _base_url ) ; } $ testview = self :: render_file ( __DIR__ . '/../assets/error-page.php' , [ 'url' => $ driver -> current_url ( ) , 'title' => $ title , 'javascript_errors' => $ driver -> javascript_errors ( ) , 'javascript_messages' => $ driver -> javascript_messages ( ) , ] ) ; $ page_content = str_replace ( '</body>' , $ testview . '</body>' , $ content ) ; file_put_contents ( $ this -> _directory . "/$filename.html" , $ page_content ) ; try { $ driver -> screenshot ( $ this -> _directory . "/$filename.png" ) ; } catch ( \ Openbuildings \ Spiderling \ Exception_Notimplemented $ e ) { // Ignore not generating the screenshot if the driver doesn't support it } }
Save the current content of the driver into an html file. Add javascript errors, messages and a title to the html content.

@param \Openbuildings\Spiderling\Driver $driver
@param string                           $filename
@param string                           $title
Save the current content of the driver into an html file . Add javascript errors messages and a title to the html content .