HTML snapshot not working on JavaScript web app

141 views
Skip to first unread message

David Tatti

unread,
Aug 5, 2014, 10:21:17 AM8/5/14
to zomb...@googlegroups.com
I'm trying to see if Zombie.js can be used as a headless browser rendering HTML snapshots for JavaScript heavy web apps (basically completely written apps in JavaScript using the framework OceanFront). This is to feed web crawlers utilizing the _escaped_fragment_ protocol.

However I can't find much information of this other than the .html() function. But in this simple scenario below, it will just show the actual index.html and not the full rendered html version of the DOM tree after the JavaScript files has been executed.


Browser.visit("https://swarmplayer.com", {debug: true, runScripts: true, loadCSS: false},function(e, b, status) {
b.wait('done', function() {
console.log(b.errors);
b.dump();
console.log(b.html());
});
});



I tried with different wait times etc in case Zombie takes time to render the JavaScript.

Also the debug output show that all JavaScript files are properly downloaded in the correct order and got a 200 on the GET request.

Am I missing something here, or is Zombie not supposed to be able to take a snapshot of the actual DOM tree using the .html() function?

Thanks!

as...@labnotes.org

unread,
Aug 5, 2014, 3:06:57 PM8/5/14
to zomb...@googlegroups.com
The html() function is a shortcut for querySelector and outerHTML and reflects the current state of the document.

--
You received this message because you are subscribed to the Google Groups "zombie.js" group.
To unsubscribe from this group and stop receiving emails from it, send an email to zombie-js+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

David Tatti

unread,
Aug 5, 2014, 3:19:41 PM8/5/14
to zomb...@googlegroups.com
Ok then I assumed correctly about the functionality of .html()

However then it means Zombies JavaScript interpreter can't handle the JavaScript on the page since it doesn't get fired properly, and it manage to download all files correctly. Dunno if I can get any error output, or a reason why it doesnt fire the JavaScript properly.

This is a bummer since it would be great to use Node.js with Zombie to do headless HTML snapshots for crawlers on more advanced JavaScript web apps.
Reply all
Reply to author
Forward
0 new messages