I have started using Zombie JS and could web scrap some simple web pages successfully.
But some web pages throw exception. So I am kind of stuck in scrapping the required page.
I have presented a very similar case here.
For example, when I scrap Google search page the following exception is thrown.
JS Code:var Browser = require("zombie");
var assert = require("assert");
browser = new Browser();
browser.visit("
https://www.google.com/", {debug:false, runScripts: true}, function () {
//submit a queryCommandEnabled
browser.fill("q","tiger");
browser.pressButton("btnG", function() {
//console.log(browser.html());
});
})
Exception:Cannot read property 'value' of undefined TypeError: Cannot read property 'value' of undefined
at Object.l [as Xf] (<anonymous>:256:367)
at _.k.$ (<anonymous>:193:426)
at new ni (<anonymous>:182:546)
at
Object.C.Ag (<anonymous>:315:499)
at Object.a (<anonymous>:321:424)
at
https://www.google.co.in/search?hl=en-IN&source=hp&q=tiger&gbv=2&btnG=Google%20Search:script:1:22 at Contextify.sandbox.run (C:\Users\185577\Downloads\NODEJS_SOFTWARE\test\node_modules\zombie\node_modules\jsdom\node_modules\contextify\lib\contextify.js:12:24)
at DOMWindow.window._evaluate (C:\Users\185577\Downloads\NODEJS_SOFTWARE\test\node_modules\zombie\lib\zombie\window.js:188:25)
at Object.HTML.languageProcessors.javascript (C:\Users\185577\Downloads\NODEJS_SOFTWARE\test\node_modules\zombie\lib\zombie\scripts.js:23:21)
at define.proto._eval (C:\Users\185577\Downloads\NODEJS_SOFTWARE\test\node_modules\zombie\node_modules\jsdom\lib\jsdom\level2\html.js:1480:47)
Can some one explain how to resolve this error or am I missing something.
Thanks
Muthukumar