Skip to content

Commit

Permalink
apply pause only when the value is not negative
Browse files Browse the repository at this point in the history
  • Loading branch information
KazuCocoa committed Feb 23, 2024
1 parent 8308192 commit b54b8ee
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions appium/webdriver/extensions/action_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from typing import TYPE_CHECKING, List, Optional, Tuple, Union, cast
from typing import TYPE_CHECKING, List, Optional, Tuple, cast

from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.actions import interaction
Expand Down Expand Up @@ -62,7 +62,7 @@ def scroll(self, origin_el: WebElement, destination_el: WebElement, duration: Op
return cast('WebDriver', self)

def drag_and_drop(
self, origin_el: WebElement, destination_el: WebElement, pause: Union[float, None] = None
self, origin_el: WebElement, destination_el: WebElement, pause: Optional[float] = None
) -> 'WebDriver':
"""Drag the origin element to the destination element
Expand All @@ -77,7 +77,7 @@ def drag_and_drop(
actions = ActionChains(self)
# 'mouse' pointer action
actions.w3c_actions.pointer_action.click_and_hold(origin_el)
if pause:
if pause is not None and pause > 0:
actions.w3c_actions.pointer_action.pause(pause)
actions.w3c_actions.pointer_action.move_to(destination_el)
actions.w3c_actions.pointer_action.release()
Expand Down

0 comments on commit b54b8ee

Please sign in to comment.