Skip to content
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

Merged
merged 4 commits into from
Feb 24, 2024
Merged

feat: add pause in drag_and_drop #961

merged 4 commits into from
Feb 24, 2024

Conversation

KazuCocoa
Copy link
Member

@KazuCocoa KazuCocoa commented Feb 22, 2024

closes #955

@@ -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
Copy link
Contributor

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:
Copy link
Contributor

@mykola-mokhnach mykola-mokhnach Feb 22, 2024

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)
Copy link
Contributor

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

Copy link
Member Author

Choose a reason for hiding this comment

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

@KazuCocoa KazuCocoa merged commit 686d486 into master Feb 24, 2024
15 of 17 checks passed
@KazuCocoa KazuCocoa deleted the add-pause branch February 24, 2024 03:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ActionHelpers extenstion 'Drag and Drop' implementation problem
2 participants