ok, I am a new learner to node.js: when I try to load google.com,and exec the script in the page,like this:
var zombie=require("zombie");
browser = new zombie.Browser({ debug: true })
browser.visit("http://www.google.com",function(err,_browser,status){
if(err){
throw(err.message);
}
})
but get error:
28 Feb 16:06:40 - The onerror handler
on target
{ frames: [ [Circular] ],
contentWindow: [Circular],
window: [Circular],
…………………………
what can I do?
The actual error message is hidden part way down the error output. Within the browser.visit function, add...
...above
throw(err.message);
. This should give you a better indication of what's going wrong :)EDIT: Having tested node 0.4.1 / zombie 0.9.1 on www.google.com, it looks like a javascript error (ILLEGAL TOKEN) is causing the problem. You can circumvent javascript errors by setting up your zombie code like so:
Personally, I don't find the current zombie error output very helpful, so I prefer to turn it off and display a simple console.log message when something goes wrong.
Lastly, you can also debug errors by passing in
debug: true
to the browser function:This will output all calls (inc. ajax) and might help to pinpoint the source of an error.
Good luck!