Skip to content

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
@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