2

I have to write a test case using UIautomator to swipe it out from the recent apps.I am trying below code but not sure what should be "id of the app".I tried running uiautomatorviewer and all apps are showing same resourceId.

uiDevice.pressRecentApps();

    UiObject app = uiDevice.findObject(new UiSelector().resourceId("The id of the app"));
    app.swipeLeft(100);
xyz
  • 31
  • 2

1 Answers1

0

You should be able to find the app using text.

UiObject app = uiDevice.findObject(new UiSelector().text("appText"));
app.swipeLeft();

If you do a search by text, then you end up getting the element that the text is actually written on.

enter image description here

I'm not sure if you can swipe on that element, so if you need a parent element this question covered how to do that.

Community
  • 1
  • 1
abrarisme
  • 495
  • 1
  • 6
  • 14