From b54b8eee139bd378d9af87e58196bdc50ec44cfb Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Thu, 22 Feb 2024 19:55:15 -0800 Subject: [PATCH] apply pause only when the value is not negative --- appium/webdriver/extensions/action_helpers.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/appium/webdriver/extensions/action_helpers.py b/appium/webdriver/extensions/action_helpers.py index b9aea3e0..a0ff5a2a 100644 --- a/appium/webdriver/extensions/action_helpers.py +++ b/appium/webdriver/extensions/action_helpers.py @@ -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 @@ -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 @@ -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()