Selenium Extension: RecordMouseDownUp

Selenium Extension: RecordMouseDownUp

Sunday, April 15, 2012

Today I wrote another extension for the Selenium IDE: RecordMouseDownUp. This has been tested with the Selenium IDE 1.7.2 and is known to work on standard devices (my friend said someone's making a sex toy for the iPad; If you happen to try it out and this extension works as expected, keep it a secret you perv! :O )

RecordMouseDownUp, the name says it all. With this extension you can record mousedown and mouseup events in Selenium 1.7.2 This extension supports left and right buttons (0 and 2), but no middle button (1). You can download the extension here: http://wiki.openqa.org/download/attachments/407/RecordMouseDownUp.js or copy the code further down this page.

RecordMouseDownUp.js

Recorder.addEventHandler('mouseDowns', 'mousedown', function (event) {
    if (event.button == 0) {
        this.record("mouseDown", this.findLocators(event.target), '');
    }
    if (event.button == 2) {
        this.record("mouseDownRight", this.findLocators(event.target), '');
    }
}, {
    capture : true
});
Recorder.addEventHandler('mouseUps', 'mouseup', function (event) {
    if (event.button == 0) {
        this.record("mouseUp", this.findLocators(event.target), '');
    }
    if (event.button == 2) {
        this.record("mouseUpRight", this.findLocators(event.target), '');
    }
}, {
    capture : true
});

☭ Hial Atropa!! ☭