brenden / node-webshot

Easy website screenshots in Node.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

captureSelector clipping page element

Glench opened this issue · comments

I'm trying to take a screenshot of the wikipedia diff box for anon and for some reason webshot seems to be clipping the element in its screenshot:

test

Here's a script to replicate the behavior:

const webshot = require('webshot');

const webshotParams = {
  captureSelector: 'table.diff.diff-contentalign-left tbody',
  errorIfStatusIsNot200: true,
  timeout: 30*1000,
};

webshot('https://en.wikipedia.org/w/index.php?diff=805825883&oldid=805825689', 'test.png', webshotParams, function(err) {
    if (err) {
        console.log(err)
    }
})

I've tried looking at the webshot code but can't see anything obviously wrong. I tried playing with the zoomFactor but that also didn't produce good results. If anyone has any ideas or fixes that would be great.