private UiObject navigateToAppLaunchIcon(String appLaunchIconName) throws UiObjectNotFoundException { // Simulate a short press on the HOME button. this.device.pressHome(); // We’re now in the home screen. Next, we want to simulate // a user bringing up the All Apps screen. // If you use the uiautomatorviewer tool to capture a snapshot // of the Home screen, notice that the All Apps button’s // content-description property has the value "Apps". We can // use this property to create a UiSelector to find the button. UiObject allAppsButton = this.device.findObject(new UiSelector().description("Apps")); // Simulate a click to bring up the All Apps screen. allAppsButton.clickAndWaitForNewWindow(); // In Android 6 default apps menu (Nexus 5X) there is a search box to locate the application // Use it to search for the application UiObject searchTextbox = this.device.findObject( new UiSelector() .resourceId("com.google.android.googlequicksearchbox:id/search_box_proxy")); searchTextbox.setText(appLaunchIconName); waitForGuiToStabilize(); // The application (if found), will be the first item in the application list container // Type: com.google.android.googlequicksearchbox:id/icon UiObject appListview = this.device.findObject( new UiSelector() .resourceId("com.google.android.googlequicksearchbox:id/apps_list_view")); UiObject selectedItem = appListview.getChild(new UiSelector().index(0)); d(uiaDaemon_logcatTag, selectedItem.getContentDescription()); return selectedItem; }