moebius#195: DOM - PointerEvent - improvements

https://github.com/MoonchildProductions/moebius/pull/195
This commit is contained in:
janekptacijarabaci 2018-04-23 11:54:06 +02:00 • committed by Roy Tam
commit a968f1d6c2
10 changed files with 228 additions and 20 deletions

View file

@ -260,10 +260,23 @@ class ElementClickInterceptedError extends WebDriverError {
if (obscuredEl && coords) {
const doc = obscuredEl.ownerDocument;
const overlayingEl = doc.elementFromPoint(coords.x, coords.y);
msg = error.pprint`Element ${obscuredEl} is not clickable ` +
`at point (${coords.x},${coords.y}) ` +
error.pprint`because another element ${overlayingEl} ` +
`obscures it`;
switch (obscuredEl.style.pointerEvents) {
case "none":
msg = error.pprint`Element ${obscuredEl} is not clickable ` +
`at point (${coords.x},${coords.y}) ` +
`because it does not have pointer events enabled, ` +
error.pprint`and element ${overlayingEl} ` +
`would receive the click instead`;
break;
default:
msg = error.pprint`Element ${obscuredEl} is not clickable ` +
`at point (${coords.x},${coords.y}) ` +
error.pprint`because another element ${overlayingEl} ` +
`obscures it`;
break;
}
}
super(msg);