Skip to content

Commit

Permalink
Swipe By Percent added duration optional variable
Browse files Browse the repository at this point in the history
  • Loading branch information
Qualify committed Aug 4, 2017
1 parent b04aec0 commit 471d703
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/AppiumLibrary/keywords/_touch.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def swipe(self, start_x, start_y, offset_x, offset_y, duration=1000):
driver = self._current_application()
driver.swipe(start_x, start_y, offset_x, offset_y, duration)

def swipe_by_percent(self, start_x, start_y, end_x, end_y):
def swipe_by_percent(self, start_x, start_y, end_x, end_y, duration=1000):
"""
Swipe from one percent of the screen to another percent, for an optional duration.
Normal swipe fails to scale for different screen resolutions, this can be avoided using percent.
Expand Down Expand Up @@ -77,9 +77,9 @@ def swipe_by_percent(self, start_x, start_y, end_x, end_y):
y_offset = y_end - y_start
platform = self._get_platform()
if platform == 'android':
self.swipe(x_start, y_start, x_end, y_end)
self.swipe(x_start, y_start, x_end, y_end, duration)
else:
self.swipe(x_start, y_start, x_offset, y_offset)
self.swipe(x_start, y_start, x_offset, y_offset, duration)

def scroll(self, start_locator, end_locator):
"""
Expand Down

0 comments on commit 471d703

Please sign in to comment.