Skip to content

Commit

Permalink
Round the X, Y of the element location
Browse files Browse the repository at this point in the history
  • Loading branch information
AutomatedTester committed Jun 15, 2016
1 parent 840ff72 commit 424eef7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions py/selenium/webdriver/remote/webelement.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,8 +368,8 @@ def location(self):
old_loc = self._execute(Command.GET_ELEMENT_RECT)
else:
old_loc = self._execute(Command.GET_ELEMENT_LOCATION)['value']
new_loc = {"x": old_loc['x'],
"y": old_loc['y']}
new_loc = {"x": round(old_loc['x']),
"y": round(old_loc['y'])}
return new_loc

@property
Expand Down

1 comment on commit 424eef7

@juangj
Copy link
Contributor

@juangj juangj commented on 424eef7 Aug 12, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was it intended to change the coordinates to (rounded) floats? The docs don't promise any particular numerical type, but I've discovered some code of ours (which I'll fix) that assumes ints are returned here.

Please sign in to comment.