From 6bed8c62b3f4192f4158837d73520696a188db4e Mon Sep 17 00:00:00 2001 From: Andrey Lushnikov Date: Fri, 16 Jun 2017 15:43:09 -0700 Subject: [PATCH] Pass integers to the Emulation.setVisibleSize Integers are required in the Emulation.setVisibleSize. This patch fixes the screenshot clipRect so that it never tries to pass float values. --- lib/Page.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Page.js b/lib/Page.js index 328bc023..51f37b49 100644 --- a/lib/Page.js +++ b/lib/Page.js @@ -395,8 +395,8 @@ class Page extends EventEmitter { if (clipRect) { await Promise.all([ this._client.send('Emulation.setVisibleSize', { - width: clipRect.width / this._screenDPI, - height: clipRect.height / this._screenDPI, + width: Math.ceil(clipRect.width / this._screenDPI), + height: Math.ceil(clipRect.height / this._screenDPI), }), this._client.send('Emulation.forceViewport', { x: clipRect.x / this._screenDPI,