Skip to content

Commit

Permalink
Element ... is not clickable at point (#2866)
Browse files Browse the repository at this point in the history
* [Firefox] Element ... is not clickable at point

The message "Element is not clickable at point..." gives no information about what element was meant to be clicked, which slows down debugging.
This commit adds more information to the error message to the Firefox driver.

* [Chrome] Element ... is not clickable at point

The message "Element is not clickable at point..." gives no information about what element was meant to be clicked, which slows down debugging.
This commit adds more information to the error message to the Chrome driver.

* Fix typo

* Refactor - reduce outerHTML removal
  • Loading branch information
phoe authored and lukeis committed Oct 4, 2016
1 parent 242a570 commit e198580
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
18 changes: 8 additions & 10 deletions javascript/chrome-driver/atoms.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,14 +240,9 @@ webdriver.chrome.isElementClickable = function(elem, coord) {
return makeResult(
false, 'Element is not clickable at point ' + coordStr);
}
var elemAtPointHTML = elemAtPoint.outerHTML;
if (elemAtPoint.hasChildNodes()) {
var inner = elemAtPoint.innerHTML;
var closingTag = '</' + elemAtPoint.tagName + '>';
var innerStart = elemAtPointHTML.length - inner.length - closingTag.length;
elemAtPointHTML = elemAtPointHTML.substring(0, innerStart) + '...' +
elemAtPointHTML.substring(innerStart + inner.length);
}
var elemAtPointHTML = elemAtPoint.outerHTML.replace(elemAtPoint.innerHTML,
elemAtPoint.hasChildNodes()
? '...' : '');
var parentElemIter = elemAtPoint.parentNode;
while (parentElemIter) {
if (parentElemIter == elem) {
Expand All @@ -259,10 +254,13 @@ webdriver.chrome.isElementClickable = function(elem, coord) {
}
parentElemIter = parentElemIter.parentNode;
}
var elemHTML = elem.outerHTML.replace(elem.innerHTML,
elem.hasChildNodes() ? '...' : '');
return makeResult(
false,
'Element is not clickable at point ' + coordStr + '. Other element ' +
'would receive the click: ' + elemAtPointHTML);
'Element ' + elemHTML + ' is not clickable at point '
+ coordStr + '. Other element ' +
'would receive the click: ' + elemAtPointHTML);
};


Expand Down
6 changes: 5 additions & 1 deletion javascript/firefox-driver/js/syntheticMouse.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,13 @@ SyntheticMouse.prototype.isElementClickable = function(element) {

var elementAtPointHTML =
elementAtPoint.outerHTML.replace(elementAtPoint.innerHTML, '');

var elementHTML =
element.outerHTML.replace(element.innerHTML, '');

return SyntheticMouse.newResponse(bot.ErrorCode.UNKNOWN_ERROR,
'Element is not clickable at point (' + coords.x + ', ' + coords.y + '). ' +
'Element ' + elementHTML + ' is not clickable at point ('
+ coords.x + ', ' + coords.y + '). ' +
'Other element would receive the click: ' + elementAtPointHTML);
};

Expand Down

0 comments on commit e198580

Please sign in to comment.