I’d like to drag and drop the object in the canvas tag.
Because it is drawn on a specific coordinate on a canvas, it does not appear to have an HTML element when I checked by the Developer tool.
And these objects only move within the canvas.
Because of this, how can I use the sourceObject and destinationObject if they cannot be specified?
I’ve already identified two drag and drop APIs from Katalon Studio…
WebUI.dragAndDropToObject(sourceObject, destinationObject)
WebUI.dragAndDropByOffset(sourceObject,xOffset,yOffset)
That’s correct. Once you enter thw world of canvas, you’re leaving the HTML/document world and entering another universe.
Short answer: you can’t.
You may get some joy with Robot API - but I’ve never used with canvas elements myself.
https://docs.oracle.com/javase/7/docs/api/index.html?java/awt/Robot.html
I implemented drag-and-drop as a robot class.
It wasn’t difficult to implement with the coordinates of my monitor. But I think I’ll need more work to get the hard-coded coordinate working properly in Jenkins, right?
Anyway, thank you for your advice. Thomas.
1 Like
can you please share your code with us where u implemented robot class
aqsa.n
June 18, 2021, 10:12am
5
Hi ,
Actually i am stuck at that point I can’t drag and drop the object on canvas means i want to set my object in specific position on canvas UT I CAN’T DO THIS , is there is any solution for this so please help me.
From
Aqsa.
Hi - may I suggest Actions for Selenium. You should be able to implement dragging and dropping to particular coordinates. I’ve used it for drawing shapes on a canvas before.
https://www.guru99.com/keyboard-mouse-events-files-webdriver.html
Hi Thanks your suggestion help me a lot now its working for me