-
Notifications
You must be signed in to change notification settings - Fork 564
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add pause in drag_and_drop #961
Conversation
@@ -61,19 +61,24 @@ def scroll(self, origin_el: WebElement, destination_el: WebElement, duration: Op | |||
actions.perform() | |||
return cast('WebDriver', self) | |||
|
|||
def drag_and_drop(self, origin_el: WebElement, destination_el: WebElement) -> 'WebDriver': | |||
def drag_and_drop( | |||
self, origin_el: WebElement, destination_el: WebElement, pause: Union[float, None] = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer Optional[float]
|
||
Returns: | ||
Union['WebDriver', 'ActionHelpers']: Self instance | ||
""" | ||
actions = ActionChains(self) | ||
# 'mouse' pointer action | ||
actions.w3c_actions.pointer_action.click_and_hold(origin_el) | ||
if pause: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if pause is not None and pause > 0
|
||
Returns: | ||
Union['WebDriver', 'ActionHelpers']: Self instance | ||
""" | ||
actions = ActionChains(self) | ||
# 'mouse' pointer action | ||
actions.w3c_actions.pointer_action.click_and_hold(origin_el) | ||
if pause: | ||
actions.w3c_actions.pointer_action.pause(pause) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume we need to convert the value to integer milliseconds according to w3c spec
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
selenium client takes care it
https://github.com/SeleniumHQ/selenium/blob/93c780439f2886607474a6cebaf4e678f9730047/py/selenium/webdriver/common/actions/pointer_actions.py#L198-L200
https://github.com/SeleniumHQ/selenium/blob/93c780439f2886607474a6cebaf4e678f9730047/py/selenium/webdriver/common/actions/pointer_input.py#L63-L64
closes #955