SyntaxError: Unexpected token <] filename: undefined
Trying to visit backbone.js based web page throws the following error:
var Browser = require("zombie");
browser = new Browser()
browser.visit("http://www.aspectiva.com/#!product/3803562/Venetian_Resort_Hotel_Casino"). then(function() { console.log(browser.html()); }). fail(function(error) { console.log("Oops", error); });
Unexpected token < SyntaxError: Unexpected token < at Contextify.sandbox.run (/tmp/node_modules/zombie/node_modules/jsdom/node_modules/contextify/lib/contextify.js:12:24) at DOMWindow.window._evaluate (/tmp/node_modules/zombie/lib/zombie/window.js:188:25) at Object.HTML.languageProcessors.javascript (/tmp/node_modules/zombie/lib/zombie/scripts.js:23:21) at define.proto._eval (/tmp/node_modules/zombie/node_modules/jsdom/lib/jsdom/level2/html.js:1480:47) at loaded (/tmp/node_modules/zombie/lib/zombie/scripts.js:74:23) at /tmp/node_modules/zombie/node_modules/jsdom/lib/jsdom/level2/html.js:76:20 at Object.item.check (/tmp/node_modules/zombie/node_modules/jsdom/lib/jsdom/level2/html.js:345:11) at /tmp/node_modules/zombie/node_modules/jsdom/lib/jsdom/level2/html.js:363:12 at /tmp/node_modules/zombie/lib/zombie/eventloop.js:238:18 at Object._onImmediate (/tmp/node_modules/zombie/lib/zombie/eventloop.js:143:11)
Is it possible to identify which resource caused the error?
The server returns an HTML document instead of JavaScript.
Can you share some guide lines how can I identify what resource is sent as HTML instead of JS?
Start with the server logs, it's usually an error page. You can also look at browser.resources, which shows all the responses Zombie recieved.