From 60621b8815207be72e465ff8dd546be5137ba3d2 Mon Sep 17 00:00:00 2001 From: Andrey Lushnikov Date: Tue, 11 Jul 2017 22:32:11 -0700 Subject: [PATCH] Fix Click unit tests on Mac OS X This patch brings screenDPI back in clicking equation, which was regressed in afb096cfd7b8b087b889822831a972552ebf6694. --- lib/Page.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Page.js b/lib/Page.js index 264ddb15..43566eac 100644 --- a/lib/Page.js +++ b/lib/Page.js @@ -512,8 +512,8 @@ class Page extends EventEmitter { try { const nodeId = await this._querySelector(selector); let boxModel = (await this._client.send('DOM.getBoxModel', { nodeId })).model.content; - let x = Math.round((boxModel[0] + boxModel[4]) / 2); - let y = Math.round((boxModel[1] + boxModel[5]) / 2); + let x = Math.round((boxModel[0] + boxModel[4]) / (2 * this._screenDPI)); + let y = Math.round((boxModel[1] + boxModel[5]) / (2 * this._screenDPI)); this._client.send('Input.dispatchMouseEvent', { type: 'mouseMoved',