Skip to content

Instantly share code, notes, and snippets.

@phellipealexandre
Last active October 29, 2018 10:27
Show Gist options
  • Save phellipealexandre/aad201aa6db4f6568941df7b52b1d1bd to your computer and use it in GitHub Desktop.
Save phellipealexandre/aad201aa6db4f6568941df7b52b1d1bd to your computer and use it in GitHub Desktop.
Snippet of UI Automator Android test
// Busca objeto que representa o device e vai para Home do smartphone
mDevice = UiDevice.getInstance(getInstrumentation());
mDevice.pressHome();
// Busca um componente clicável através do seu content description.
// Nesse caso o botão que aciona o launcher do smartphone.
UiObject allAppsButton = mDevice.findObject(new UiSelector().description("Apps"));
// Executa um click no botão anterior para carregar o launcher.
allAppsButton.clickAndWaitForNewWindow();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment