Domanda

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.

È stato utile?

Soluzione

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();
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top