Drag and drop feature is not working.
Even I tried to record for testing, but this feature is not working as you see in below image.
Drag and drop feature is not working.
Even I tried to record for testing, but this feature is not working as you see in below image.
You should try to use a custom keyword instead. This article: https://www.katalon.com/resources-center/tutorials/drag-drop-web-applications-katalon-studio/ provides helpful information to deal with HTML5 controls, which is similar to your case.
I tried your steps, but not working.
WebUI.click(findTestObject(âPage_erwin/div_Collectionâ))
is clicking the element
WebUI.dragAndDropToObject(findTestObject(âPage_erwin/div_Collectionâ), findTestObject(âNew Folder/canvas_This text is displayedâ),
FailureHandling.STOP\_ON\_FAILURE)
But this code is not doing the drag and drop.
I am able to do the drag and drop from QTP with below line of code.
Browser(âMeet your new browserâ).Page(âerwin_6â).WebElement(âCollectionâ).Drag
Browser(âMeet your new browserâ).Page(âerwin_6â).WebElement(âCollectionâ).Drop 160,180
but not from selenium or Katalon.Any suggestion.
Hi there,
My above tutorial indicates you need to write your own custom keyword and use it in your project. Please use that instead of using âDrag and Drop to Objectâ keyword.
In your example, you are dragging an element and dropping it on another.And the first element is moved to new position.
But in my case, it persists at both locations.
Check below once.
Even I tried your steps, but still same issue.
WebUI.dragAndDropToObject(findTestObject(âNew Folder/div_Collectionâ), findTestObject(âNew Folder/canvas_This text is displayedâ))
Both approaches, html and javascript are not working, it is not showing as failed also in the Katalon code, it is just blinking the element on the screen.
WebUI.dragAndDropToObject(findTestObject(âNew Folder/div_Collectionâ), findTestObject(âNew Folder/canvas_This text is displayedâ))
CustomKeywords.âdnd.DragAndDropHelper.dragAndDropâ(findTestObject(âNew Folder/div_Collectionâ), findTestObject(âNew Folder/canvas_This text is displayedâ))
And also everytime I am executing complete code, is there any option to execute only part of code as in selenium.
Hi there,
No my provided article just gives you a sample how you should do drag and drop for special cases, not drag and drop it from one object to other object.
I still see you are using âDrag and Drop to Objectâ built-in keyword, please try using custom keyword from above project instead:
uday kiran reddy said:
Both approaches, html and javascript are not working, it is not showing as failed also in the Katalon code, it is just blinking the element on the screen.
WebUI.dragAndDropToObject(findTestObject(âNew Folder/div_Collectionâ), findTestObject(âNew Folder/canvas_This text is displayedâ))
CustomKeywords.âdnd.DragAndDropHelper.dragAndDropâ(findTestObject(âNew Folder/div_Collectionâ), findTestObject(âNew Folder/canvas_This text is displayedâ))
And also everytime I am executing complete code, is there any option to execute only part of code as in selenium.
So can you provide me your website so that I can investigate?
Actually it is a staging environment and gave only one account to us, if you want I can share my screen whenever you ask.
Thank you very much for your prompt response.
I had issues with drag and drop. Neither the built in keyword or customkeyword in github solved my issue. The solution provided in below URL helped me.
https://ynot408.wordpress.com/2011/09/22/drag-and-drop-using-selenium-webdriver/
Katalon code
import static com.kms.katalon.core.checkpoint.CheckpointFactory.findCheckpoint
import static com.kms.katalon.core.testcase.TestCaseFactory.findTestCase
import static com.kms.katalon.core.testdata.TestDataFactory.findTestData
import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
import com.kms.katalon.core.checkpoint.Checkpoint as Checkpoint
import com.kms.katalon.core.checkpoint.CheckpointFactory as CheckpointFactory
import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as MobileBuiltInKeywords
import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile
import com.kms.katalon.core.model.FailureHandling as FailureHandling
import com.kms.katalon.core.testcase.TestCase as TestCase
import com.kms.katalon.core.testcase.TestCaseFactory as TestCaseFactory
import com.kms.katalon.core.testdata.TestData as TestData
import com.kms.katalon.core.testdata.TestDataFactory as TestDataFactory
import com.kms.katalon.core.testobject.ObjectRepository as ObjectRepository
import com.kms.katalon.core.testobject.TestObject as TestObject
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WSBuiltInKeywords
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUiBuiltInKeywords
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
import internal.GlobalVariable as GlobalVariable
import org.openqa.selenium.Keys as Keys
WebUI.openBrowser(ââ)
WebUI.navigateToUrl(âhttps://stagingbeta.myerwin.io/loginâ)
WebUI.setText(findTestObject(âPage_erwin/input_usernameâ), âukreddyâ)
WebUI.setText(findTestObject(âPage_erwin/input_passwordâ), ââPasswordââ)
WebUI.click(findTestObject(âPage_erwin/input_login-form-submitâ))
WebUI.click(findTestObject(âPage_erwin/div_Data Modeler NoSQLâ))
WebUI.click(findTestObject(âPage_erwin/i_material-icon-addâ))
WebUI.click(findTestObject(âPage_erwin/i_icon-mongodbâ))
WebUI.click(findTestObject(âPage_erwin/i_clickable-icon material-iconâ))
WebUI.click(findTestObject(âPage_erwin/div_Collectionâ))
WebUI.click(findTestObject(âPage_erwin/div_Fieldâ))
WebUI.dragAndDropToObject(findTestObject(âPage_erwin/div_Collectionâ), findTestObject(âObject Repository/Page_erwin/canvas_This text is displayedâ))
---
Last drag and drop not working
Hello, have you found any solution to this problem ?
I am still stucked on a similar one
Hello,
Anyone got a working solution to this DragnDrop issue?
Iâve tried both (keyword and âDragAndDropToObjectâ) and same result: step is successfully executed but the drag n drop was not performed. Katalon is lyingâŚ
Iâve also tried 20 combinations of grad and dropping different objects⌠in vainâŚ
Hi there,
Pls try the below approach : It worked for me.
WebDriver driver = DriverFactory.getWebDriver();
WebElement LocatorFrom = driver.findElement(By.xpath("//drag")); // draggable
WebElement LocatorTo = driver.findElement(By.xpath("//drop")); // droppable
String xto=Integer.toString(LocatorTo.getLocation().x);
String yto=Integer.toString(LocatorTo.getLocation().y);
((JavascriptExecutor)driver).executeScript('function simulate(f,c,d,e){var b,a=null;for(b in eventMatchers)if(eventMatchers[b].test(c)){a=b;break}if(!a)return!1;document.createEvent?(b=document.createEvent(a),a==\'HTMLEvents\'?b.initEvent(c,!0,!0):b.initMouseEvent(c,!0,!0,document.defaultView,0,d,e,d,e,!1,!1,!1,!1,0,null),f.dispatchEvent(b)):(a=document.createEventObject(),a.detail=0,a.screenX=d,a.screenY=e,a.clientX=d,a.clientY=e,a.ctrlKey=!1,a.altKey=!1,a.shiftKey=!1,a.metaKey=!1,a.button=1,f.fireEvent(\'on\'+c,a));return!0} var eventMatchers={HTMLEvents:/^(?:load|unload|abort|error|select|change|submit|reset|focus|blur|resize|scroll)$/,MouseEvents:/^(?:click|dblclick|mouse(?:down|up|over|move|out))$/}; ' +
'simulate(arguments[0],\'mousedown\',0,0); simulate(arguments[0],\'mousemove\',arguments[1],arguments[2]); simulate(arguments[0],\'mouseup\',arguments[1],arguments[2]); ', LocatorFrom,xto,yto);
Thanks, Iâve tried that way as well⌠unfructifying.
I think that Katalon is simply incompetent with Java Ext JS app. Too bad⌠movingâŚ
Can you share the URL?
Edit: Are you able to achieve the drag and drop using Selenium. If so, Please share the code.
If the drag and drop is possible using Selenium, then definitely it is possible via Katalon.
I have the same issue identical to Davidâs above. I have tried Drag and Drop to Object, Drag and Drop by Offset, and the keyword DragAndDropHelper. I was able to get the example in the article above to work. However when I try the same method on my tests I get a false postivie and the Custom Keyword doesnt have any affect that I can see. I donât think the locators are the issue as I use them for other tests. Is there something else I could be doing wrong or something else I could try?
@adam.stephens Agree. None of the options work as desired.
I have also tried the object and the keyword which was suggested but both options return false positive.
The closer call is the keyword but it doesnât drop on the desired locator/position.
Katalon developers @Zarashima @duyluong have to take this as a bug and work on a fix.