Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fill in password EditText with Android uiautomator?

Is it possible for the uiautomator to select a password EditText? I have no problem finding other EditText views by their android:hint property, but the uiautomatorviewer shows all password fields as NAF. I tried setting the password field content description and that didn't work either.

If it's not possible, how do you set a timeout for a tester to manually enter a password?

like image 382
kevin.schultz Avatar asked Feb 19 '13 01:02

kevin.schultz


1 Answers

I had the same problem with API v16. Today I tried my script with v17 (Android 4.2) and it worked like a charm. It seems that the first version of uiautomator has some major bugs.

Here is my code:

// click the admin button
new UiObject(new UiSelector().text("admin")).click();
// set pwd text
new UiObject(new UiSelector().description("pwdEditText")).setText("admin");
// click login button
new UiObject(new UiSelector().description("loginButton")).click();
like image 180
Michal Vician Avatar answered Nov 07 '22 07:11

Michal Vician