node.js - Why showing phantom std out error when using Nightmare.js or phantom.js to scrape website -
I am trying to write a web-spider using phantom.js. Although I have made a lot of mistake, I do not know why my code is shown below:
-
Use Nightmare.js :
var nightmare = essential ('nightmare'); New Nightmare () .goto ('http://www.amazon.com/Aroma-Housewares-aSP-137-3-Quart-super/dp/B00024JQ3Q'). Evaluate (function () {return document.getElementById (' Priceblock_ourprice '). TextContent;}, function (numAnchors) {console.log (numAnchors);}) Run ();
-
Use phantom.js :
var page = is required (' Webpage '). Surge (); Console.log ('is the default user agent' + page.settings.userAgent); Page.open ('http://www.amazon.com/Aroma-HouseWares-ASP-137-3-Quart-Super/dp/B00024JQ3Q', function (status) {if (status! == 'success') { Console.log ('Unable to access the network');} Other {var ua = page.evaluate (function () {return document.getElementById ('priceblock_ourprice'). TextContent;}); console.log (ua);} Phantom. Go outside ();});
The error message is similar:
Phantom stdout: reference error: the variable can not be found: OK. ..... ........ ........ Phant Stout: Type error: 'empty' is not an object (evaluation 'Old Dior Handler, Apli') ...... . $ 35.99
I can get results in the last line but there are many errors shown above, what is the reason?
This will be very much like the existing PentomJs (1.9.7) Chrome X or Safari 5 equivalent to the old QTWebKit Based on the fork. The page in question is probably used by some in its JavaScript, which is not understood by the PhantomJS. Most of the time, there is nothing to worry about because the site will still be desired.
Comments
Post a Comment