Skip to content

API App

Tobero edited this page Mar 13, 2023 · 3 revisions

DefaultApp


The default app enum contains the some packages that are installed by default. The enum currently holds:

  • CHROME
  • CAMERA

AppElement


constructor(device: Device, rawElement)

Creates a new app element. Reads the rawElement attributes to create the element.

click(): Promise

Clicks this element. Doesn't autoscroll to the make the element visible right now

Example

  const hierarchy = await emulator.hierarchy();
  const element = hierarchy.findElementsByText("Chrome")[0];
  await element.click();

async type(text: string): Promise

Types the given text into the element. The element gets clicked before typing automatically. No other buttons except the ones required to create the text will be pressed in the process (No enter / closing of the keyboard)

Example

  const hierarchy = await emulator.hierarchy();
  const searchField = hierarchy.findElementsByText("Search or type", true)[0];
  await searchField.type("https://www.npmjs.com/package/gotron");

get rawElement(): SelectedValue

Gets the raw element

get index(): string

Get the index of the element

get text(): string

Get the text of the element

get resourceId(): string

Get the resourceId of the element

get className(): string

Get the classname of the element

get packageName(): string

Get the packageName of the element

get contentDesc(): string

Get the content description of the element

get checkable(): boolean

Get if the element is checkable

get checked(): boolean

Get if the element has been checked

get clickable(): boolean

Get if the element can be clicked

get enabled(): boolean

Get if the element has been enabled

get focusable(): boolean

Get if the element is focusable

get focused(): boolean

Get if the element is already focused

get scrollable(): boolean

Get if the element is scrollable

get longClickable(): boolean

Get if you can long click the element

get password(): boolean

Get if the elment is a password field

get selected(): boolean

Get if the element has been selected

get bounds(): Bounds

Get the element's bounds