I want get text string shown in a textview in LinearLayout. can espresso do that? If not, is there other way to do that or can I use android api in espresso test case? I am using API 17 18 or newer, espresso 1.1(It should be the latest one.). I have no clue about this. Thanks.
相关问题
- TestCafe - The browser always starts in clean slat
- Is it possible to use the TestCafe .meta object to
- What is a correct approach to manage test data usi
- How to click unrendered virtualized element in Tes
- How do I pass variable data between tests
相关文章
- Open file from windows file dialog with python aut
- Using proguard with espresso/androidTest
- How to pass Query String Parameters in GET url usi
- Flaky Android Espresso Test - Snackbar
- Run internet explorer as different user using Sele
- Selenium: Not able to understand xPath
- Coded UI build server integration process
- org.openqa.selenium.ElementNotVisibleException: El
If you want to check text value with another text, you can create Matcher. You can see my code to create your own method:
The basic idea is to use a method with an internal ViewAction that retrieves the text in its perform method. Anonymous classes can only access final fields, so we cannot just let it set a local variable of getText(), but instead an array of String is used to get the string out of the ViewAction.
Note: This kind of view data retrievers should be used with care. If you are constantly finding yourself writing this kind of methods, there is a good chance, you're doing something wrong from the get go. Also don't ever access the View outside of a
ViewAssertion
orViewAction
, because only there it is made sure, that interaction is safe, as it is run from UI thread, and before execution it is checked, that no other interactions meddle.