Skip to content

Commit

Permalink
firefox driver, when determining an point that's clickable, start wit…
Browse files Browse the repository at this point in the history
…h the middle of the edges rather than the corners, since people like their rounded corners and the click doesn't work with them there.

Fixes #2497
  • Loading branch information
lukeis committed Jul 22, 2016
1 parent d8be9a9 commit 23a24f5
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions javascript/firefox-driver/js/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -746,12 +746,17 @@ Utils.getClickablePoint = function(element) {
};

var findClickablePoint = function(r) {
// center, center of edges, corners
var offsets = [
{ x: Math.floor(r.width / 2), y: Math.floor(r.height / 2) },
{ x: 0, y: 0 },
{ x: r.width - 1, y: 0 },
{ x: 0, y: r.height - 1 },
{ x: r.width - 1, y: r.height - 1}
{ x: Math.floor(r.width / 2), y: Math.floor(r.height / 2) }, // center
{ x: Math.floor(r.width / 2), y: 0}, // top edge center
{ x: 0, y: Math.floor(r.height / 2)}, // left edge center
{ x: r.width - 2, y: Math.floor(r.height / 2)}, // right edge center
{ x: Math.floor(r.width / 2), y: r.height - 2}, // bottom edge center
{ x: 0, y: 0 }, // top left corner
{ x: r.width - 1, y: 0 }, // top right corner
{ x: 0, y: r.height - 1 }, // bottom left corner
{ x: r.width - 1, y: r.height - 1} // bottom right corner
]

return goog.array.find(offsets, function(offset){
Expand Down

0 comments on commit 23a24f5

Please sign in to comment.