How to stabalize drag and drop action

Hi,

I am doing drag and drop action using the in-built keyword provided by Katalon V8.6.6.
But it does not work always. Many a time, it got failed. I want to stabalize it.
And before doing the drag and drop, I even verified if both the elements are present or not and they are present but still, i am getting this error many a time.

Error:

at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187)
	at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122)
	at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49)
	at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158)
	at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
	at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
	at com.kms.katalon.selenium.driver.CChromeDriver.execute(CChromeDriver.java:19)
	at org.openqa.selenium.remote.RemoteWebDriver.perform(RemoteWebDriver.java:618)
	at org.openqa.selenium.support.events.EventFiringWebDriver.lambda$new$1(EventFiringWebDriver.java:105)
	at com.sun.proxy.$Proxy26.perform(Unknown Source)
	at org.openqa.selenium.support.events.EventFiringWebDriver.perform(EventFiringWebDriver.java:360)
	at org.openqa.selenium.interactions.Actions$BuiltAction.perform(Actions.java:639)
	at org.openqa.selenium.interactions.Actions.perform(Actions.java:595)
	at com.kms.katalon.core.webui.keyword.builtin.DragAndDropToObjectKeyword$_dragAndDropToObject_closure1.doCall(DragAndDropToObjectKeyword.groovy:102)
	at com.kms.katalon.core.webui.keyword.builtin.DragAndDropToObjectKeyword$_dragAndDropToObject_closure1.call(DragAndDropToObjectKeyword.groovy)
	at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:20)
	at com.kms.katalon.core.webui.keyword.builtin.DragAndDropToObjectKeyword.dragAndDropToObject(DragAndDropToObjectKeyword.groovy:74)
	at com.kms.katalon.core.webui.keyword.builtin.DragAndDropToObjectKeyword.execute(DragAndDropToObjectKeyword.groovy:68)
	at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:74)
	at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.dragAndDropToObject(WebUiBuiltInKeywords.groovy:2648)
	at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$dragAndDropToObject$17.call(Unknown Source)
	at Script1682071036536.run(Script1682071036536.groovy:164)

Pls help…

Thanks in advance,
Hritik

1 Like

Hi @hritik, This link might put you on the right path: The click on below + icon is not working properly - #6 by Dave_Evers

Hi @Dave_Evers ,
I have already added the these steps like waitForElementPresent, waitForElementVisible, but still they are failing to drag and drop.
And as i said, it does not happen everytime but most of the time.

is there any other i can achieve the stabalization customizing the keyword or something like that.

Thanks,
Hritik

Hi @hritik, Please include your HTML code so folks can see what you have done/are dealing with. Remember to use 3 back ticks one line before your HTML code and 3 back ticks one line after your HTML code for easier reading.
Thanks Dave

1 Like

You can read the source of org.openqa.selenium.remote.http.W3CHttpResponseCode class of version 3.141.59, which is bundled in the Katalon Studio v8.6.x and v9.x, at

At around line#122, I found an interesting comment:

      // For now, we'll inelegantly special case unhandled alerts.
      if ("unexpected alert open".equals(error) &&
          HTTP_INTERNAL_ERROR == encodedResponse.getStatus()) {
        String text = "";
        Object data = obj.get("data");
        if (data != null) {
          Object rawText = ((Map<?, ?>) data).get("text");
          if (rawText instanceof String) {
            text = (String) rawText;
          }
        }
        response.setValue(new UnhandledAlertException(message, text));
      } else {
        response.setValue(createException(error, message));
      }

They (Selenium developers) seem not to be very confident in dealing of some special cases.

What is the “special cases” they mean? — I don’t know.

@hritik

Do you have any idea what is the “special case”? Can you identify any common nature of failing cases?

If you could identify the nature of failure, you might be able to find how to manage it.

I suppose, Selenium WebDriver can not process the response of that negative nature, throws Exception.

I suppose, KS can do nothing for you to make every cases passing.