1

I have a scenario where l have to drag a image from one iframe and drop to other iframe. I am thinking of following solution

Some switch frame logic then drag

  • script("var myDragEvent = new Event('dragstart'); myDragEvent.dataTransfer = new DataTransfer()")
  • waitFor('{}Draggable 1').script("_.dispatchEvent(myDragEvent)")
  • script("var myDropEvent = new Event('drop');

Some Logic to switch to switch frame to root Some Logic to switch frame to drop frame

myDropEvent.dataTransfer = myDragEvent.dataTransfer")

  • script("// some xpath", "_.dispatchEvent(myDropEvent)")
  • screenshot()

However this is not working for me

Piyush
  • 11
  • 1
  • iframes and drag are the hardest things in ui automation, so my recommendation is use some workaround or skip this automation as it may not be worth it. please refer this: https://stackoverflow.com/a/60800181/143475 – Peter Thomas Oct 10 '22 at 16:22

1 Answers1

0

This has worked for me, it works with Iframes as well; you can give it a try -

* script("var dragStartEvent = new MouseEvent('dragstart', {bubbles: true, cancelable: true, view: window});")
* script("var dropEvent = new MouseEvent('drop', {bubbles: true, cancelable: true, view: window});")
* waitFor("//*[@id='panel1a-content']/div/div[1]").script("_.dispatchEvent(dragStartEvent)")
* script("[data-testid='section__column-section__0--column__0']", "_.dispatchEvent(dropEvent)")