Advertisement
Guest User

Untitled

a guest
Oct 1st, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. getBoundingClientRect: function(selector, callback) {
  2. var webdriverio = this._webdriverio;
  3.  
  4. webdriverio.getElementSize(selector)
  5. .then(function(size) {
  6.  
  7. webdriverio.getLocation(selector)
  8. .then(function(location) {
  9.  
  10. var rect = {
  11. width: size.width,
  12. height: size.height,
  13. top: location.y,
  14. left: location.x,
  15. bottom: location.y + size.height,
  16. right: location.x + size.width
  17. };
  18.  
  19. callback(null, rect);
  20. })
  21. .catch(function(error) {
  22. callback(error);
  23. });
  24. })
  25. .catch(function(error) {
  26. callback(error);
  27. });
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement