Skip to content

Commit 7db2aff

Browse files
authored
Merge pull request #356 from js361014/rect
Added get_element_rect
2 parents 53188a1 + 4eb3771 commit 7db2aff

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

AppiumLibrary/keywords/_element.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,17 @@ def get_element_size(self, locator):
445445
self._info("Element '%s' size: %s " % (locator, element_size))
446446
return element_size
447447

448+
def get_element_rect(self, locator):
449+
"""Gets dimensions and coordinates of an element
450+
451+
Key attributes for arbitrary elements are `id` and `name`. See
452+
`introduction` for details about locating elements.
453+
"""
454+
element = self._element_find(locator, True, True)
455+
element_rect = element.rect
456+
self._info("Element '%s' rect: %s " % (locator, element_rect))
457+
return element_rect
458+
448459
def get_text(self, locator):
449460
"""Get element text (for hybrid and mobile browser use `xpath` locator, others might cause problem)
450461

0 commit comments

Comments
 (0)