Zombie.js Returns Improper Page Content

Ascectveiva

New Member
I am new to zombie and just trying to get a basic test running. I have the following code:\[code\]var Browser = require('zombie');var startTime = +new Date();Browser.visit("http://zombie.labnotes.org/", function(e, browser) { var duration; console.log("Successfully visted the page"); console.log(browser.html()); duration = (+(new Date())) - startTime; console.log("Finished in (milliseconds): " + duration);});\[/code\]For some reason all I get back in the console is:Successfully visted the page\[code\]<html> <head></head> <body></body></html>Finished in (milliseconds): 5020\[/code\]This is obviously not the right mark up and it takes quite a bit of time (5 seconds) to do that. Any ideas?UPDATE: ended up switching to a simpler model using request and jsdom. Here is the code I used: var request = require('request'), jsdom = require('jsdom');\[code\]//Tell the request that we want to fetch youtube.com, send the results to a callback functionrequest({uri: 'http://youtube.com'}, function(err, response, body){ var self = this; self.items = []; //Just a basic error check if(err && response.statusCode !== 200){console.log('Request error.');} //Send the body param as the HTML code we will parse in jsdom //also tell jsdom to attach jQuery in the scripts and loaded from jQuery.com jsdom.env({ html: body, scripts: ['http://code.jquery.com/jquery-1.6.min.js'] }, function(err, window){ //Use jQuery just as in a regular HTML page var $ = window.jQuery; console.log(body); });});\[/code\]Taken from: http://net.tutsplus.com/tutorials/javascript-ajax/how-to-scrape-web-pages-with-node-js-and-jquery/But I would still like to know what went wrong with Zombie as I would like to use it for testing on other projects.
 
Top