intern
intern copied to clipboard
Incorrect base coordinate for moveMouseTo offset
In Intern 4.x (and probably 5-pre), the base coordinate for the moveMouseTo command may be incorrect. According to the JWP spec, any offset should be relative to the top-left corner of the element. In at least Chrome and EdgeChromium, it has been reported that the offset is relative to the center of the element.
This is likely due to chromedriver using stricter W3C semantics, in which case the fallback code for /moveto would be used since W3C WebDriver doesn't support a /moveto endpoint.
A test like the following will reproduce the issue with Intern 4.8, Chrome 79, Selenium 3.141.59, and chromedriver 79.0.3945.36.
import { describe, it } from 'intern/lib/interfaces/bdd';
describe('clicking', () => {
it('should offset from the top left', async ({ remote }) => {
await remote.get('/tests/functional/page.html');
const div = await remote.findByCssSelector('.clickarea');
await remote.moveMouseTo(div, 0, 0);
await remote.pressMouseButton();
await remote.releaseMouseButton();
await remote.sleep(5000);
});
});
The gray box in the image below is div.clickarea; the green box inside of it is centered on the mouse click position.
Possibly related to https://github.com/mozilla/geckodriver/issues/789 (and Firefox does exhibit the same behavior when using the /moveto endpoint).