问题
I tried to use id to click on the object in an android application but when i enter solo.clickOnImageButton(R.id.action_menu_search); It is showing an error, that action_menu_search cannot be resolved or not a field. How can i use the id of an object to click on the same.
Thank you in advance, With regards, David Gayler
回答1:
Use solo.clickOnView(solo.getView(int id));
回答2:
Method clickOnImageButton takes parameter as index, not id, so you should use method, which Renas has mentioned.
来源:https://stackoverflow.com/questions/19424408/how-can-i-use-id-to-do-action-on-an-object-of-an-android-using-robotium-tool