Skip to content

Add "Drag And Drop Across Frames" keyword for cross-frame drag and drop support#1953

Open
b-vamsipunnam wants to merge 5 commits intorobotframework:masterfrom
b-vamsipunnam:feature/drag-and-drop-to-frame
Open

Add "Drag And Drop Across Frames" keyword for cross-frame drag and drop support#1953
b-vamsipunnam wants to merge 5 commits intorobotframework:masterfrom
b-vamsipunnam:feature/drag-and-drop-to-frame

Conversation

@b-vamsipunnam
Copy link
Copy Markdown
Contributor

@b-vamsipunnam b-vamsipunnam commented Dec 14, 2025

Summary

This PR adds a new keyword Drag And Drop Across Frames to support drag-and-drop interactions where the source and target are in different frame contexts.

Motivation

While automating post-deployment flows in a Salesforce Service Cloud setup, I encountered a limitation where drag-and-drop failed when the drop target was inside an iframe. Existing keywords do not support this scenario because WebDriver action chains lose context when switching frames mid-action.

Real-world scenario (Salesforce Service Cloud):
Login → Setup → All Sites → Builder → Select Dashboard → Drag and drop a component into a target section (inside an iframe) → Publish

The existing Drag And Drop keyword fails in this case because the target resides inside an iframe.

This aligns with known limitations:

This keyword enables reliable end-to-end automation for such scenarios.

Changes

  • Added implementation in src/SeleniumLibrary/keywords/element.py
  • Added acceptance tests in atest/acceptance/keywords/draganddropframe.robot
  • Added test HTML page atest/resources/html/frames/draganddrop.html
  • Updated unit test keyword count in utest/test/api/test_plugins.py

All acceptance tests pass locally, including the new cross-frame scenarios.

All acceptance tests pass locally (including new ones).

This addresses a long-standing limitation around cross-frame drag-and-drop. If applicable, please consider adding the acknowledgment label to #120 for release notes. Thank you!

@b-vamsipunnam b-vamsipunnam force-pushed the feature/drag-and-drop-to-frame branch from 91af1a0 to d283eb4 Compare December 20, 2025 21:16
@emanlove emanlove self-assigned this Dec 20, 2025
@b-vamsipunnam b-vamsipunnam changed the title Feature: Add New keyword Drag And Drop To Frame Add New keyword "Drag And Drop To Frame" Mar 30, 2026
@b-vamsipunnam b-vamsipunnam force-pushed the feature/drag-and-drop-to-frame branch from d283eb4 to bf869a0 Compare April 11, 2026 16:56
@b-vamsipunnam b-vamsipunnam changed the title Add New keyword "Drag And Drop To Frame" Add "Drag And Drop To Frame" keyword for cross-frame drag-and-drop Apr 11, 2026
@b-vamsipunnam
Copy link
Copy Markdown
Contributor Author

Hi @emanlove ,
I’ve updated the PR to align with the project’s keyword signature to use the new Locator type alias, and the PR is now scoped to:

  • The new Drag And Drop To Frame keyword implementation
  • Then updated acceptance tests

All tests are now passing in GitHub Actions. Please take another look when you have a chance. Thanks!

Copy link
Copy Markdown
Member

@yuriverweij yuriverweij left a comment

Choose a reason for hiding this comment

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

Thanks for this PR! it looks very promising, but there are a few things that need to be resolved.

  • There is a bug in the try/except which can cause the mouse button to stay down.
  • The test fixture (html file) has some problems which can give false positives
  • Suggestion: the keyword can be made a bit more generic allowing dragging from frame to frame or default context to frame. (in this case the Note can be removed from the docstring)
  • Suggestion: add the following to the docstring/description After this keyword runs, the browser context is always default content, regardless of the context before the call.

Comment thread src/SeleniumLibrary/keywords/element.py Outdated
Comment thread atest/acceptance/keywords/draganddropframe.robot Outdated
Comment thread atest/acceptance/keywords/draganddropframe.robot Outdated
Comment thread atest/acceptance/keywords/draganddropframe.robot Outdated
Comment thread src/SeleniumLibrary/keywords/element.py Outdated
Comment thread atest/resources/html/frames/draganddrop.html
@b-vamsipunnam b-vamsipunnam changed the title Add "Drag And Drop To Frame" keyword for cross-frame drag-and-drop Add "Drag And Drop Across Frames" keyword for cross-frame drag and drop support Apr 26, 2026
@b-vamsipunnam
Copy link
Copy Markdown
Contributor Author

Hi @yuriverweij

Thanks for the detailed feedback.

I’ve updated the fixture so the drop completes only when the mouseup occurs within the target element inside the target iframe, avoiding false positives.

The keyword now also supports an optional source frame and ensures the mouse is released on failure before resetting context.

@emanlove: If this looks good, could you please consider adding the acknowledgment label to #120 for release notes? Thank you.

Copy link
Copy Markdown
Member

@yuriverweij yuriverweij left a comment

Choose a reason for hiding this comment

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

On test doesn't do what it claims to do. For the rest it looks good to me.

Maybe @emanlove still has some other suggestions/feedback and I'll let him have the final say.

Comment thread atest/resources/html/frames/draganddrop.html Outdated
Comment thread atest/acceptance/keywords/draganddropframe.robot
Comment thread atest/acceptance/keywords/draganddropframe.robot Outdated
@b-vamsipunnam
Copy link
Copy Markdown
Contributor Author

Hi @yuriverweij : Thanks for all the feedback. I’ve addressed the comments and made the suggested updates. Happy to make any further changes if needed.

Thank you.

Copy link
Copy Markdown
Member

@yuriverweij yuriverweij left a comment

Choose a reason for hiding this comment

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

Looks good to me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants