javascript - How to make correspond PhantomJS screenshot dimension with an actual webpage? -


i taking screenshot webpage of mine phantomjs. code simply

var page = require('webpage').create(); page.open('target_zone_selection.html', function () {     page.viewportsize = {width: 1024, height: 800};     page.render('test.png');     phantom.exit(); }); 

everything work fine, want make correspond screenshot actual webpage (as seen on browser accurate viewport size). ultimate goal mouse position , make correspond position on screenshot.

and there problem : webpage size different rendering phantomjs. i've tried several solution, going through dom , take each offset position find dimension of screenshot, there problem. method works width, not height.

could describe way make webpage , screenshot correspond ? lot !

update : problem spotted : webpage contains canvas, buttons, text form , html. element not give same size once rendered phantomjs button... , rendering of button differs between browsers...

any suggestion predict rendered size of button ?

are talking viewport tag mobile devices? "desktop" browsers phantomjs not support viewport. need @ tools or services support mobile browsers (like https://browshot.com/)


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -