hey guys,
I captured the phone number object and also the place where I want to drop it however it does not want to drag and drop. Below is an example of how it should look before and after. Any help appreciated. Thanks
hey guys,
I captured the phone number object and also the place where I want to drop it however it does not want to drag and drop. Below is an example of how it should look before and after. Any help appreciated. Thanks
How about trying this solution? https://www.katalon.com/resources-center/tutorials/drag-drop-web-applications-katalon-studio/.
Thanks Vinh, got it working now, not sure why the built-in draganddrop function did not work however the creating a new keyword worked
Is there a way to use this custom dnd keyword in another keyword?
I have created a custom keyword via the actions object. this allows you to select a source and destination webelement and within the destination you can define your offset (where in the destination object you want to drop it. it is based on the actions object
snippet code is this(do not forget to add these imports into the code)
import com.kms.katalon.core.webui.common.WebUiCommonHelper
import org.openqa.selenium.interactions.Action
import org.openqa.selenium.interactions.Actions
import org.openqa.selenium.WebDriver
import java.time.Duration
public class DragDrop {
@Keyword
def dragdrop(TestObject to,TestObject destination,Integer intX,Integer intY) {
def eleto = WebUiCommonHelper.findWebElement(to, 30)
def eledest = WebUiCommonHelper.findWebElement(destination, 30)
WebDriver driver = DriverFactory.getWebDriver()
Actions build = new Actions(driver)
.moveToElement(eleto)
.pause(Duration.ofSeconds(3))
.clickAndHold(eleto)
.moveByOffset(1, 0)
.moveToElement(eledest,intX,intY)
//.moveByOffset(40, 0)
.pause(Duration.ofSeconds(5))
.release().perform()
}
}
good luck
Please check below