I am trying to run some automated tests in Robotium. I have the following code in my application that sets up an options menu:
public boolean onCreateOptionsMenu(com.actionbarsherlock.view.Menu menu) { com.actionbarsherlock.view.MenuInflater inflater = getSupportMenuInflater(); inflater.inflate(R.layout.logoutmenu, menu); return super.onCreateOptionsMenu(menu); }
I am trying to click on a menu in Robotium using the code:
solo.sendKey(Solo.MENU); solo.clickOnView(solo.getView(R.id.share));
However, my tests do not work due to an error:
View is null and therefore cannot be clicked.
I also tried using the code below, which also failed:
solo.clickOnView(solo.getView(R.id.logoutmenu)); solo.clickOnMenuItem("Share My Artists");
AndroidEnthusiast
source share