Skip to content

Commit

Permalink
Add example
Browse files Browse the repository at this point in the history
- Find objects
  • Loading branch information
dtmilano committed Aug 20, 2023
1 parent 055051f commit 562c850
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion examples/helper/find-object-by-regex
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#! /usr/bin/env python3
#
# Finds the object containing a content description that matches a pattern that starts wih 'Battery',
# Finds the object containing a content description that matches a pattern that starts with 'Battery',
# extracts the charging percentage, and prints it.
#

Expand Down
16 changes: 16 additions & 0 deletions examples/helper/find-objects-by-regex
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#! /usr/bin/env python3
#
# Finds the object containing text that matches a pattern that ends in 'mail',
# loops trhough the objects and dumps them.
#

from com.dtmilano.android.viewclient import ViewClient
try:
from rich import print
except:
pass

helper = ViewClient.view_client_helper()

for obj in helper.ui_device.find_objects(body={'text': 'Pattern:^.*mail$'}):
print(helper.ui_object2.dump(obj.oid), end="\n\n")

0 comments on commit 562c850

Please sign in to comment.