#Uiautomator android studio tutorial android
In the Android framework, you can also find Espresso: but what is the difference? Our objective here is humble: launching a video from the Youtube application on Android. Let’s write together a first test scenario with UI Automator ! Thanks to UI Automator, you can, for instance, launch an application, fill a login field, navigate in menus… This framework lets you interact with visible elements of a smartphone screen: click a button, fill a text field, scroll down, etc. Like its name states it, UI Automator is a framework provided by Android allowing to execute User Interface (UI) functional tests in an automated way. Unfortunately, the "payButton" can be null, better way check it before using if (payButton.Share on Facebook Share on Twitter Share on Linkedin Reading Time: 4 minutes UiObject payButton = new UiObject(new UiSelector().text("Pay")) You can find a UI element on the screen use next line of code. You can find more information here about this class. UiObject espresso = coffees.getChildByText( You also can get can a specific coffee that is called "Espresso" from the collection. If you want to get the number of coffees in this collection, which displayed on screen. Root object of this collection is RelativeLayout.
#Uiautomator android studio tutorial how to
The following snippet of code display how to initialize collection. Represents a collection of items, as example list of coffees in a coffee order application. The UiCollection used to enumerate screen elements for the purpose of counting, or targeting sub elements by text, description, index, etc.