jquery - phantom stdout: TypeError: undefined is not a constructor (evaluating) -


i use nightmare (phantomjs wrapper) crawl webpage, error:

phantom stdout: typeerror: undefined not constructor (evaluating '$('a[href="/dien-thoai/apple-iphone-6-plus-64gb-ban-quoc-te--pid975.html"]').get(0).closest('section')')

var nightmare = require('nightmare');  var bandcamp = new nightmare()     .useragent("mozilla/5.0 (windows nt 6.3; wow64) applewebkit/537.36 (khtml, gecko) chrome/38.0.2125.111 safari/537.36")     .goto('http://viettelstore.vn/danh-muc/dien-thoai-010001.html#specorder=')     .wait()     .click('a[href="/apple-mid1.html"]')     .wait()     .screenshot('viettelstore.png')     .evaluate(function () {         var x = $('a[href="/dien-thoai/apple-iphone-6-plus-64gb-ban-quoc-te--pid975.html"]').get(0).closest('section')         var y = $(x).find('.b-price.b-price_size3').find('.b-price__num').text()         return {name: y};     },function (value) {console.log(value.name);})     .run(function (err, nightmare) {         if (err) return console.log(err);         console.log('done!');     }); 

the page screenshort after clicking right expected. jquery code run ok when testing in console of browser. think problem come phantomjs


Comments

Popular posts from this blog

How to provide Authorization & Authentication using Asp.net, C#? -

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

android - Pass an Serializable object in AIDL -