Skip to content Skip to sidebar Skip to footer

Long Press In Uiautomation

I am working on Uiautomation for android using eclipse in the moto X device android 4.4 kitkat.I am doing automation to connect to wifi with a static IP and using OPEN security. To

Solution 1:

Use swipe(int startX, int startY, int endX, int endY, int steps) to perform a long click for the time you wish. The last parameter, steps, determines the time. For 100 steps, the swipe will take about 1/2 of a second to complete. The greater the value of steps, the longer the duration of the press. Example:

UiObjectconnect=newUiObject(newUiSelector().className("android.widget.LinearLayout").instance(6));
RectrectButton= connect.getBounds();
UiDevicedevice= UiDevice.getInstance();
device.swipe(rectButton.centerX(), rectButton.centerY(), rectButton.centerX(), rectButton.centerY(), 200);

Here, connect is the UiObject which I am performing a long click on.

Post a Comment for "Long Press In Uiautomation"