Reputation: 2305
I'm trying to send text to a view that I know the id of. It seems enterText() wants an int, but all I have is a view.
solo.enterText(solo.getView(R.id.et_firstname_insurance), firstName);
Ideas? I read the API documentation and can't figure it out.
Upvotes: 1
Views: 2161
Reputation: 1092
What worked for me - assertTrue("btnUseEmailToLogin View is not visible", (solo.getView("idName") ).isShown() == true);
Where idName - is the id of desired view to check
Upvotes: 0
Reputation: 543
you can assign this to a view
as view1 and then you can use
solo.enterText(view1, firstName);
and if that also doesn't work try using solo.clickOnView(view1);
and after that solo.enterText(view1, firstName);
Upvotes: 0
Reputation: 2305
I figured it out with the help of my coworker. This turns the view into an EditText object, which can be passed into one of the flavors of enterText:
public static EditText getEditText(int i) {
return (EditText) solo.getCurrentActivity().findViewById(i);
}
EditText eFn = RobotiumHelpers.getEditText(R.id.et_firstname_insurance);
solo.enterText(eFn, firstName);
Upvotes: 1
Reputation: 471
I'm pretty sure that this is not allowed. Robotium is testing purposes and if you're changing the whole state of the activity externally than that defeats the purpose and might possibly have the ability to do damage. Now if you're talking about entering text in something that is editable than the int is the editable field number. Check out the tutorial
Upvotes: 0