leadfoot icon indicating copy to clipboard operation
leadfoot copied to clipboard

IE10+: fire pointerdown and pointerup on click

Open wkeese opened this issue 11 years ago • 14 comments

Calling .click() on IE10 doesn't emit an mspointerdown event, and similarly calling .click() on IE11 doesn't emit a pointerdown event.

I assume this is a webdriver problem but leadfoot is supposed to work around that.   Perhaps it's already firing mousedown/mouseup, but it would be good if it fired the pointer events too, since that's what actually happens when the user clicks on IE10+.

wkeese avatar Oct 02 '14 02:10 wkeese

Can you please verify the value of the nativeEvents capability in the returned caps for the system you are testing against and report back?

csnover avatar Oct 02 '14 02:10 csnover

this.remote.environmentType.nativeEvents is true (or at least truthy). I'm testing on IE10 and IE11 on Saucelabs.

wkeese avatar Oct 02 '14 02:10 wkeese

A trivial test case (and "feature test") is:

pointerdown.html:

<!DOCTYPE HTML>
<html>
<body>
    <span id="span" onpointerdown="span.innerHTML='got pointerdown';">click me</span>
</body>
</html>

pointerdown.js

define([
    "require",
    "intern",
    "intern!object",
    "intern/chai!assert"
], function (require, intern, registerSuite, assert) {

    registerSuite({
        name: "pointerdown event on id",

        basic: function () {
            return this.remote
                .get(require.toUrl("./pointerdown.html"))
                .findById("span")
                    .click()
                    .getVisibleText()
                .then(function (text) {
                    assert.strictEqual(text, "got pointerdown");
                });
        }
    });
});

That's for IE11. It needs to be adjusted for IE10 to use mspointerdown.

wkeese avatar Oct 31 '14 02:10 wkeese

I've tested this with IE10, and pointer events are firing. Handlers added both through the DOM (onmspointerdown) and via JS (addEventListener('MSPointerDown')) seem to work fine.

jason0x43 avatar Nov 03 '14 14:11 jason0x43

More information: I tested IE10 running on Win7 using Selenium 2.44.0 and IEDriverServer 2.44.0 32-bit. It should theoretically be fine with older versions of Selenium since pointer events support was added back in 2.34.0, but I'll check some additional combinations.

jason0x43 avatar Nov 03 '14 17:11 jason0x43

@jason0x43 - How about IE11 on Saucelabs? If you can reproduce the problem there, then it probably means the problem was fixed in a newer release of IEDriverServer.

wkeese avatar Nov 03 '14 22:11 wkeese

After running a number of trials on Sauce, it looks like IE 11 on Windows 7 works, but IE 11 on Windows 8.1 does not. Both OSes run the same fairly recent version of Selenium (2.42.0) and InternetExplorerDriver (2.42.0 32-bit). The Win8.1 machine runs Java 24.65-b04, and the Win7 runs Java 24.60-b04; it seems unlikely that a patch version difference in Java would make a huge difference, though.

jason0x43 avatar Nov 04 '14 15:11 jason0x43

OK, thanks for trying that; I'm glad you could reproduce the problem in one scenario. How about running on Win8.1 (and IE11) locally? (Your original local test ran against Win7 and IE11.) It sounds likely to me that the problem is not the Java version but the OS version.

wkeese avatar Nov 04 '14 21:11 wkeese

More information... On a local Windows 8.1 VM, selenium server 2.42.0 won't even register the InternetExplorerDriver binary because 2.42.0 doesn't know the platform WIN8_1. This bug was patched in 2.43.0. I'm guessing that Windows Server 2012, which is what Sauce is using for Win8.1, doesn't show up as WIN8_1 to Selenium.

Regardless, that's only half the problem. The other issue is IEDriver's flakey support for native events. To get pointer events to register you have to disable native event support by adding nativeEvents: false to your IE environment config. With native events disabled, pointer events worked in my tests with IE11 + Win8.1 for Selenium 2.43+, and even for 2.42 on Sauce.

jason0x43 avatar Nov 04 '14 22:11 jason0x43

Wow, OK, interesting. I'm not sure what the side effects of adding nativeEvents: false are. It seems nativeEvents: false would interfere with things like pressKeys(keys.TAB) advancing from one <input> to another, but perhaps not.

wkeese avatar Nov 04 '14 23:11 wkeese

Is this still an issue?

csnover avatar Sep 25 '15 07:09 csnover

Yup, unfortunately still happens, see https://saucelabs.com/tests/444563213e524053bb29cbe2a4e8d150.

wkeese avatar Sep 25 '15 23:09 wkeese

Because of this issue, we cannot make the tests run in IE. @jason0x43 suggested to use nativeEvents: false, but once we use it, the mouse hovering (moveMouseTo() stops working)

LingSpb avatar Jul 13 '16 14:07 LingSpb

FYI, I confirmed that on SauceLabs, Leadfoot uses native events on IE11/Windows 7, but not on IE11/Windows 8.1 nor IE11/Windows 10.

As listed in #83 this is presumably due to the brokenMouseEvents environment test failing on Win 8.1 and Win10.

wkeese avatar Jan 18 '17 00:01 wkeese