Testing soft keyboard with Robotium

64 views
Skip to first unread message

guosheng Zhou

unread,
Feb 25, 2016, 12:24:33 AM2/25/16
to Robotium Developers
Hi
I am writing test cases for a 3rd part input method using Robotium , like typing a key on the soft keyboard and take a screenshot of it . I can see the view on the soft keyboard using hierarchy viewer and I can get the position and size of the view like this : 
currentActivity = mSolo.getCurrentActivity();
mainKeyboardId = currentActivity.getResources().getIdentifier("keyboard_flipper", "id", currentActivity.getPackageName());
keyboardView = mSolo.getView(mainKeyboardId);
keyboardHeight = keyboardView.getHeight();
keyboardWidth = keyboardView.getWidth();
and it works fine on android 6.0 . But it does not work on android 5.0 and older version , with error message :
junit.framework.AssertionFailedError: View with id: '2131493440' is not found!
at com.robotium.solo.Solo.getView(Solo.java:2976)
at com.robotium.solo.Solo.getView(Solo.java:2953)
and return 0 when I trying to get the view count using mSolo.getViews().size() .

Thanks!
Reply all
Reply to author
Forward
0 new messages