Open Mrxiaoxie opened 7 years ago
This happened to me long time ago.
setText
maybe more reliable because it uses Android API to input text , while typeText
use Instrumentation sendStringSync
, it emulates soft keyboard to enter text.
Thank you!
But If I use solo.setEditText(text,'2.2222')
, the result of text.getText().toString()
is empty.
I want to simulate the actions of users,but this problem bother me a lot.
When I use typetext() to verify edittext limit conditions , I found that the order of text is wrong. my code:
Edite text = solo.getEditText(0); solo.setText(text,""); solo.typeText(text,'2.2222'); assertEquals("2.22", text.getText().toString());
but I get actual result is 22.22 not 2.22 how can I avoid this situation? thank you in advance!