Adding the drag-and-drop action in a Web UI test

When you record a Web UI test that requires you to drag and drop an object manually onto another object, you must edit the recorded test to add the drag-and-drop action.

Before you begin

You must have recorded a Web UI test. See Recording a Web UI test.

About this task

When you record a Web UI test that requires you to drag an object and drop it in a different location on the same web page, the drag-and-drop action provides an input to complete the task. For example, you can drag an amount for payment among the available denominations, such as 1000, 3000, and 5000 and drop it on the payment field. When you drag '1000' to the payment field, HCL OneTest UI captures the draggable object '1000', but the drag-and-drop action is not evident. You must then edit the test to add the Drag-drop action and specify the Xpath, Id, or the x, y coordinates that identifies the drop location for the object. The subsequent playbacks of the test display the added action.

Procedure

  1. Double-click the test to open it from the Test Navigator view.
  2. Select the test step that contains the object for which you want to add the drag-and-drop action in the Test Contents area.
  3. Select Drag-drop from the Object’s actions list in the User Action Details section.
    The Drop to object list with a text box is displayed.
  4. Select one of the following options to specify the drop location for the object:
    Option Action
    To Point x, y Enter the x, y coordinates of the drop location in the text box.
    By Id
    1. Click the required object in the SmartShot View, and then copy the Id.
    2. Paste the Id in the text box.
    By Xpath
    1. Click the required object in the SmartShot View, and then copy the Xpath from the Properties panel.
    2. Paste the Xpath in the text box.
    The step is modified to display a Drag-drop statement with the value you chose. For example, Drag-drop Division to target object with Xpath //*[@id="payment"] whose Content is 1000.
  5. Save the test.

What to do next

You can run the test and verify the results of the drag-and-drop action in the unified report. See Running a Web UI test and Unified reports for Web UI, mobile, and Windows tests.