Skip to content

Instantly share code, notes, and snippets.

@jimevans
Created November 10, 2011 15:07
Show Gist options
  • Save jimevans/1355063 to your computer and use it in GitHub Desktop.
Save jimevans/1355063 to your computer and use it in GitHub Desktop.
window.document.__webdriver_script_fn = (function() { return function(){var e = arguments[0];
var p = e.parentNode;
var x = e.offsetLeft + (e.clientWidth / 2);
var y = e.offsetTop + (e.clientHeight / 2);
var s = window.getComputedStyle ? window.getComputedStyle(p, null) : p.currentStyle;
// Condition changed. It was: while (p != null && s.overflow != 'auto' &&
// s.overflow != 'scroll' && s.overflow != 'hidden')
while (p != null &&
s != null &&
s.overflow &&
s.overflow != 'auto' &&
s.overflow != 'scroll' &&
s.overflow != 'hidden') {
p = p.parentNode;
s = window.getComputedStyle ? window.getComputedStyle(p, null) : p.currentStyle;
}
var containerTop = p.scrollTop;
var containerLeft = p.scrollLeft;
return p != null && (x < containerLeft || x > containerLeft + p.clientWidth || y < containerTop || y > containerTop + p.clientHeight);
};})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment