php-phantomjs icon indicating copy to clipboard operation
php-phantomjs copied to clipboard

Vue Js Components not showing

Open NaCl4Ever opened this issue 7 years ago • 2 comments

I've been attempting to use this tool to capture a simple screenshot of a page in browser. It works perfect on pages without any vue.js components, but any form of vue component just doesn't appear on the screen. Below is how I invoke the tool. Not sure if I simply missed a configuration or if it's a greater issue with Vue.JS. I have even attempted adding simple JavaScript alerts directly into the page and those also don't show up.

$client = Client::getInstance();
        $client->getEngine()->addOption('--load-images=true');
        $client->getEngine()->setPath('path/to/phantomjs');
        $request  = $client->getMessageFactory()->createCaptureRequest('http://localhost:909/');
        $request->setDelay(5);
        $top    = 0;
        $left   = 0;
        $width  = 1200;
        $height = 1200;
        $request->setCaptureDimensions($width, $height, $top, $left);
        $request->setViewportSize($width, $height);
        $response = $client->getMessageFactory()->createResponse();
        $file = '/path/to/save/file';
        $request->setOutputFile($file);       
        $client->send($request, $response);  

NaCl4Ever avatar Jun 14 '17 15:06 NaCl4Ever

I don't think this is related to Vue.js, if it's able to save the image somewhere than it's working. I have recently gotten this to work with an app that is using Vue on the front end. Do you have any Vuejs code to share?

andreliem avatar Nov 11 '17 22:11 andreliem

Unfortunately I have since left the company that I wrote the code for, so I can't provide the code anymore. But the best way I could describe it is the Vue is used to display a list of results from an ajax called at page load. It's a simple table component I had built nothing fancy. The only thing I could think of was that implementing a delay would help, but it never appeared even after waiting over 20 seconds, and the element would have loaded.

NaCl4Ever avatar Nov 29 '17 14:11 NaCl4Ever