From f47c054133d28cf77e49c140f45325dec6eb06d0 Mon Sep 17 00:00:00 2001 From: Cheng Lou Date: Sat, 14 Dec 2013 23:39:16 -0500 Subject: [PATCH] fix browser click event record `click` registers twice when the clicked item is something wrapped inside a `label`, say a `checkbox`. Being recorded twice means that during the replay, the checkbox is quickly checked and unchecked. `mousedown` fixes this. --- huxley/run.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/huxley/run.py b/huxley/run.py index 7c01432..dc5342d 100644 --- a/huxley/run.py +++ b/huxley/run.py @@ -110,7 +110,7 @@ def record(cls, d, remote_d, url, screen_size, path, diffcolor, sleepfactor, sav d.execute_script(''' (function() { var events = []; -window.addEventListener('click', function (e) { events.push([+new Date(), 'click', [e.clientX, e.clientY]]); }, true); +window.addEventListener('mouseup', function (e) { events.push([+new Date(), 'click', [e.clientX, e.clientY]]); }, true); window.addEventListener('keyup', function (e) { events.push([+new Date(), 'keyup', String.fromCharCode(e.keyCode)]); }, true); window._getHuxleyEvents = function() { return events; }; })();