Skip to content

feat: add pause in drag_and_drop#961

Merged
KazuCocoa merged 4 commits intomasterfrom
add-pause
Feb 24, 2024
Merged

feat: add pause in drag_and_drop#961
KazuCocoa merged 4 commits intomasterfrom
add-pause

Conversation

@KazuCocoa
Copy link
Copy Markdown
Member

@KazuCocoa KazuCocoa commented Feb 22, 2024

closes #955


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
Copy Markdown
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]

actions = ActionChains(self)
# 'mouse' pointer action
actions.w3c_actions.pointer_action.click_and_hold(origin_el)
if pause:
Copy link
Copy Markdown
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

# 'mouse' pointer action
actions.w3c_actions.pointer_action.click_and_hold(origin_el)
if pause:
actions.w3c_actions.pointer_action.pause(pause)
Copy link
Copy Markdown
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
Copy Markdown
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