Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions needle/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,16 @@ def get_dimensions(self):
Returns a dictionary containing, in pixels, the element's ``width`` and
``height``, and it's ``left`` and ``top`` position relative to the document.
"""

# Support for retina displays
dpr = self._parent.execute_script('return window.devicePixelRatio')
location = self.location
size = self.size
return {
"top": location['y'],
"left": location['x'],
"width": size['width'],
"height": size['height']
"top": location['y'] * dpr,
"left": location['x'] * dpr,
"width": size['width'] * dpr,
"height": size['height'] * dpr
}

def get_screenshot(self):
Expand Down