Question

Has anybody tried creating a new APN profile using UIAutomator ? Could you please share how you access that 'plus' button to bring up menu to click 'New APN'. If there is any direct method to do this, it is appreciable.

Était-ce utile?

La solution

General:

There are 2 general ways to click on views using UI Automator:

  • Using the text inside the textview (or subclass)
  • Using the content-description of the view

How to find the content-description?

  • Take an xml snapshot by using the Hierarchy viewer

Your use-case:

The content description of the + sign is language dependant:

  • for english this is "New APN"
  • for dutch this is "Nieuwe APN"

Code sample:

new UiObject(new UiSelector().className("android.widget.TextView").description("New APN")).click();
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top