Skip to main content

DragDrop

Description

This command allows you to drag an element or text from a specified zone and drop it on another element.

Parameters

NameValueDescription
ZonestringSelect Zone - Native or Web
DragElementstringThe xpath identifier of the element to be dragged
DragIndexintSpecify index if the element appears more than once
DropElementstringThe xpath identifier of the element onto which the previous element will be dropped
DropIndexSpecify index if the element appears more than once

Usage

You can use this command to test drag drop scenarios if your app allows that (i.e. your app is a game that incorporates the dragging and dropping of elements).

Example

info

Replace <server> with the appropriate URL.

Usage of DragDrop Command

driver = new AndroidDriver(new URL("<server>"), dc);
seetest = new SeeTestClient(driver);


...
...

// specify how much time should pass before the drag action starts
// this ensures that the dragged elements is caught
seetest.setDragStartDelay(1000);
// locate the element at coordinates x: 250, y: 100 and clicks on it three times
seetest.dragDrop("NATIVE", "xpath=//*[@text='DemoUI']", 0, "xpath=//*[@text='EriBank']", 0);



In this example, dragging the DemoUi element on top of the EriBank element will create a folder that contains them both.