The objects (o1,o2) are found. But dragAndDropToObject can’t find them.
o1 = findTestObject(‘Object Repository/Page_Bearbeiten der Kategoriestrukt/Neue Kategorie’)
o2 = findTestObject(‘Object Repository/Page_Bearbeiten der Kategoriestrukt/Droppable Area’)
WebUI.dragAndDropToObject(o1, o2)
Error-Message: Unable to drag and drop to object (Root cause: com.kms.katalon.core.webui.exception.WebElementNotFoundException: Web element with id: ‘Object Repository/Page_Bearbeiten der Kategoriestrukt/Neue Kategorie’ located by ‘By.xpath: //h4[count(. | id(“wrapper”)/div[@class=“content”]/div[@class=“row”]/div[@class=“col-xs-12”]/div[@class=“content-wrapper content-wrapper-m container-fluid”]/div[@class=“panel-content panel”]/div[@class=“panel-body”]/div[@class=“row”]/div[@class=“col-xs-3”]/div[@class=“panel panel-success new-category-panel”]/div[@class=“panel-body”]/div[@class=“dragable”]/ul[@class=“list-category-new list-group”]/li[@class=“list-group-item ui-draggable ui-draggable-handle”]/div[@class=“row”]/div[@class=“col-xs-10”]/div[@class=“row”]/h4[@class=“list-group-item-heading list-category-item-title”]) = count(id(“wrapper”)/div[@class=“content”]/div[@class=“row”]/div[@class=“col-xs-12”]/div[@class=“content-wrapper content-wrapper-m container-fluid”]/div[@class=“panel-content panel”]/div[@class=“panel-body”]/div[@class=“row”]/div[@class=“col-xs-3”]/div[@class=“panel panel-success new-category-panel”]/div[@class=“panel-body”]/div[@class=“dragable”]/ul[@class=“list-category-new list-group”]/li[@class=“list-group-item ui-draggable ui-draggable-handle”]/div[@class=“row”]/div[@class=“col-xs-10”]/div[@class=“row”]/h4[@class=“list-group-item-heading list-category-item-title”])]’ not found)
This is the import you want: import org.openqa.selenium.WebDriver.You can also quickly organize your import in the current test script by pressing: Ctrl + Shift + O (Windows)
Test Cases/testDragDrop1 FAILED because (of) org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
file:/C:/Users/win7inst/Katalon%20Studio/dummy_test/Scripts/testDragDrop1/Script1491980179320.groovy: 25: unable to resolve class WebDriver
@ line 25, column 11.
WebDriver driver = DriverFactory.getWebDriver()
How about utilizing functions in Actions class provided by Selenium for your case to simplify mouse steps? Below is the full example to simulate drag and drop action:
If you really want to do mouseUp, mouseDown or mouseMove, I also have the following example. Just replace mouseMove with mouseUp or mouseDown you want.
Hi Nguyen, thank you for your fast reply and the example with Robot. Does this mean that I have to develop all my testcases in NetBeans IDE with Robot? Is there no way for a plugin in Katalon which can handle these simple mouse actions?
It seems that my application does not use the DragDrop mechanism. Therefore I have to simulate the mouse events like MouseDown, MouseMove and MouseUp. In the documentation and the forum I found no information about.
I have to test a website written in yii. As you can see the xpath of my application is a bit complex. Maybe this is the problem that the objects are not found.
Can you try some different interaction steps on either object 01 or 02 such as click, wait for… and see if they still have the same issue? Clearly, that message in your post states that the element is not found with provided xpath, so it can’t drag and drop objects.
I suggest you check on the simple but unique identifier of object’s properties such as Id in test object’s details.