node.js - Screenshot element - Update node scope's variable within browser's scope [Nightmarejs] -


i'm trying take screenshot of particular element of webpage. in order so, i've been trying use nightmarejs' 'screenshot' method. requires rectangle object gives coordonates , dimensions method.

the issue don't have coordonates , dimensions before evaluation of page. i've tried use global variable pass 'evaluate' function. unfortunately, it's not updating 'rect' variable.

according documentation (and understanding of it), code below should able pass variable 'evaluate'.

var rect;  nightmare.goto(url) (...) .evaluate(function(rect){       rect = {         x : element.x,         y : element.x,         width : element.width,         height: element.height     }   },rect) .screenshot('snapshot.png',rect) .then(function(){     console.log('done'); }); 

but not. i'm aware can't pass functions/object 'evaluate', here, i'm not doing that. can confirm ?

i've tried use 'nightmare-screenshot-selector' module. seems me that's work elements there when dom ready. can confirm ?

i'd know how can achieve goal : take screenshot of specific element that's not there when dom ready.

anyone ?


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -