Skip to content

hansalemaos/adbactivityautolite

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Uses -dumpsys activity top- instead of -uiautomator- to automate Android

Tested against Windows / Python 3.11 / Anaconda

pip install adbactivityautolite

from adbactivityautolite import UiActivityDumpLite
adbpath = r"C:\Android\android-sdk\platform-tools\adb.exe"
serial_number = "127.0.0.1:5555"
ad = UiActivityDumpLite(
    adb=None,
    adb_path=adbpath,
    serial_number=serial_number,
)
# Alternative:
# adbpath = r"C:\Android\android-sdk\platform-tools\adb.exe"
# serial_number = "127.0.0.1:5555"
# # s2 = AdbCommands(adbpath, serial_number)  #
# ad=UiActivityDumpLite(adb=s2)
df = ad.get_df(
    timeout=60,
    with_fu=True,
    t_long_touch=1,
)

print(df[20:30].to_string())
df.loc[df.aa_id_information == "app:id/app_name_three"].ff_mouse_longtap.iloc[0](
    3
)  # 3 seconds click
df.loc[df.aa_id_information == "app:id/app_name_three"].ff_mouse_tap.iloc[0]()
#     aa_activity_id  aa_activity_index aa_area               aa_bounds aa_center_x aa_center_x_cropped aa_center_y aa_center_y_cropped                aa_class_name aa_clickable                                                                                                                aa_complete_dump aa_context_clickable aa_cropped_x_end aa_cropped_x_start aa_cropped_y_end aa_cropped_y_start aa_depth aa_drawn aa_enabled aa_focusable aa_get_parents aa_hashcode_hex aa_hashcode_int aa_height aa_height_cropped            aa_id_information  aa_is_child aa_long_clickable aa_mID_hex  aa_mID_int aa_old_index aa_pflag_activated aa_pflag_dirty_mask aa_pflag_focused aa_pflag_hovered aa_pflag_invalidated aa_pflag_is_root_namespace aa_pflag_prepressed aa_pflag_selected               aa_pure_id aa_scrollbars_horizontal aa_scrollbars_vertical aa_visibility aa_width aa_width_cropped aa_x_end aa_x_end_relative aa_x_start aa_x_start_relative aa_y_end aa_y_end_relative aa_y_start aa_y_start_relative    ff_dpad_longtap    ff_dpad_tap ff_gamepad_longtap ff_gamepad_tap ff_joystick_longtap ff_joystick_tap ff_keyboard_longtap ff_keyboard_tap   ff_mouse_longtap   ff_mouse_tap  ff_stylus_longtap  ff_stylus_tap         ff_tap ff_touchnavigation_longtap ff_touchnavigation_tap ff_touchpad_longtap ff_touchpad_tap ff_touchscreen_longtap ff_touchscreen_tap ff_trackball_longtap ff_trackball_tap  parent_000  parent_001  parent_002  parent_003  parent_004  parent_005  parent_006  parent_007  parent_008  parent_009  parent_010  parent_011  parent_012  parent_013  parent_014  parent_015  parent_016  parent_017  parent_018
# 11              11                  1    7632    (642, 828, 801, 876)         721                 721         852                 852      android.widget.TextView        False                               android.widget.TextView{2886955 V.ED..... ........ 0,142-159,190 #7f080062 app:id/app_name_three}                False              801                642              876                828       11     True       True        False        loc: 11         2886955        42494293        48                48        app:id/app_name_three         True             False   7f080062  2131230818           42              False               False            False            False                False                      False               False             False        id/app_name_three                    False                  False             V      159              159      801               159        642                   0      876               190        828                 142  x: 721 y: 852 t:1  x: 721 y: 852  x: 721 y: 852 t:1  x: 721 y: 852   x: 721 y: 852 t:1   x: 721 y: 852   x: 721 y: 852 t:1   x: 721 y: 852  x: 721 y: 852 t:1  x: 721 y: 852  x: 721 y: 852 t:1  x: 721 y: 852  x: 721 y: 852          x: 721 y: 852 t:1          x: 721 y: 852   x: 721 y: 852 t:1   x: 721 y: 852      x: 721 y: 852 t:1      x: 721 y: 852    x: 721 y: 852 t:1    x: 721 y: 852          39          30          28          26          24           6           5           4           3           2           0           1        <NA>        <NA>        <NA>        <NA>        <NA>        <NA>        <NA>
# 12              12                  1   10000    (830, 720, 930, 820)         880                 880         770                 770   android.widget.FrameLayout        False                            android.widget.FrameLayout{ef66c5b V.E...... ......ID 29,34-129,134 #7f080057 app:id/app_image_four}                False              930                830              820                720       11    False       True        False        loc: 12         ef66c5b       251030619       100               100        app:id/app_image_four         True             False   7f080057  2131230807           44              False                True            False            False                 True                      False               False             False        id/app_image_four                    False                  False             V      100              100      930               129        830                  29      820               134        720                  34  x: 880 y: 770 t:1  x: 880 y: 770  x: 880 y: 770 t:1  x: 880 y: 770   x: 880 y: 770 t:1   x: 880 y: 770   x: 880 y: 770 t:1   x: 880 y: 770  x: 880 y: 770 t:1  x: 880 y: 770  x: 880 y: 770 t:1  x: 880 y: 770  x: 880 y: 770          x: 880 y: 770 t:1          x: 880 y: 770   x: 880 y: 770 t:1   x: 880 y: 770      x: 880 y: 770 t:1      x: 880 y: 770    x: 880 y: 770 t:1    x: 880 y: 770          43          30          28          26          24           6           5           4           3           2           0           1        <NA>        <NA>        <NA>        <NA>        <NA>        <NA>        <NA>
# 13              13                  1    7632    (801, 828, 960, 876)         880                 880         852                 852      android.widget.TextView        False                                android.widget.TextView{bb345d1 V.ED..... ........ 0,142-159,190 #7f08005f app:id/app_name_four}                False              960                801              876                828       11     True       True        False        loc: 13         bb345d1       196298193        48                48         app:id/app_name_four         True             False   7f08005f  2131230815           46              False               False            False            False                False                      False               False             False         id/app_name_four                    False                  False             V      159              159      960               159        801                   0      876               190        828                 142  x: 880 y: 852 t:1  x: 880 y: 852  x: 880 y: 852 t:1  x: 880 y: 852   x: 880 y: 852 t:1   x: 880 y: 852   x: 880 y: 852 t:1   x: 880 y: 852  x: 880 y: 852 t:1  x: 880 y: 852  x: 880 y: 852 t:1  x: 880 y: 852  x: 880 y: 852          x: 880 y: 852 t:1          x: 880 y: 852   x: 880 y: 852 t:1   x: 880 y: 852      x: 880 y: 852 t:1      x: 880 y: 852    x: 880 y: 852 t:1    x: 880 y: 852          43          30          28          26          24           6           5           4           3           2           0           1        <NA>        <NA>        <NA>        <NA>        <NA>        <NA>        <NA>
# 14              14                  1   10000   (989, 720, 1089, 820)        1039                1039         770                 770   android.widget.FrameLayout        False                            android.widget.FrameLayout{8a57337 V.E...... ......ID 29,34-129,134 #7f080056 app:id/app_image_five}                False             1089                989              820                720       11    False       True        False        loc: 14         8a57337       145060663       100               100        app:id/app_image_five         True             False   7f080056  2131230806           48              False                True            False            False                 True                      False               False             False        id/app_image_five                    False                  False             V      100              100     1089               129        989                  29      820               134        720                  34  x:1039 y: 770 t:1  x:1039 y: 770  x:1039 y: 770 t:1  x:1039 y: 770   x:1039 y: 770 t:1   x:1039 y: 770   x:1039 y: 770 t:1   x:1039 y: 770  x:1039 y: 770 t:1  x:1039 y: 770  x:1039 y: 770 t:1  x:1039 y: 770  x:1039 y: 770          x:1039 y: 770 t:1          x:1039 y: 770   x:1039 y: 770 t:1   x:1039 y: 770      x:1039 y: 770 t:1      x:1039 y: 770    x:1039 y: 770 t:1    x:1039 y: 770          47          30          28          26          24           6           5           4           3           2           0           1        <NA>        <NA>        <NA>        <NA>        <NA>        <NA>        <NA>
# 15              15                  1    7584   (960, 828, 1118, 876)        1039                1039         852                 852      android.widget.TextView        False                                android.widget.TextView{dd56e0d V.ED..... ........ 0,142-158,190 #7f08005e app:id/app_name_five}                False             1118                960              876                828       11     True       True        False        loc: 15         dd56e0d       232091149        48                48         app:id/app_name_five         True             False   7f08005e  2131230814           50              False               False            False            False                False                      False               False             False         id/app_name_five                    False                  False             V      158              158     1118               158        960                   0      876               190        828                 142  x:1039 y: 852 t:1  x:1039 y: 852  x:1039 y: 852 t:1  x:1039 y: 852   x:1039 y: 852 t:1   x:1039 y: 852   x:1039 y: 852 t:1   x:1039 y: 852  x:1039 y: 852 t:1  x:1039 y: 852  x:1039 y: 852 t:1  x:1039 y: 852  x:1039 y: 852          x:1039 y: 852 t:1          x:1039 y: 852   x:1039 y: 852 t:1   x:1039 y: 852      x:1039 y: 852 t:1      x:1039 y: 852    x:1039 y: 852 t:1    x:1039 y: 852          47          30          28          26          24           6           5           4           3           2           0           1        <NA>        <NA>        <NA>        <NA>        <NA>        <NA>        <NA>
# 16              16                  1   10000  (1147, 720, 1247, 820)        1197                1197         770                 770   android.widget.FrameLayout        False                             android.widget.FrameLayout{2d40bd3 V.E...... ......ID 29,34-129,134 #7f080059 app:id/app_image_six}                False             1247               1147              820                720       11    False       True        False        loc: 16         2d40bd3        47451091       100               100         app:id/app_image_six         True             False   7f080059  2131230809           52              False                True            False            False                 True                      False               False             False         id/app_image_six                    False                  False             V      100              100     1247               129       1147                  29      820               134        720                  34  x:1197 y: 770 t:1  x:1197 y: 770  x:1197 y: 770 t:1  x:1197 y: 770   x:1197 y: 770 t:1   x:1197 y: 770   x:1197 y: 770 t:1   x:1197 y: 770  x:1197 y: 770 t:1  x:1197 y: 770  x:1197 y: 770 t:1  x:1197 y: 770  x:1197 y: 770          x:1197 y: 770 t:1          x:1197 y: 770   x:1197 y: 770 t:1   x:1197 y: 770      x:1197 y: 770 t:1      x:1197 y: 770    x:1197 y: 770 t:1    x:1197 y: 770          51          30          28          26          24           6           5           4           3           2           0           1        <NA>        <NA>        <NA>        <NA>        <NA>        <NA>        <NA>
# 17              17                  1    7584  (1118, 828, 1276, 876)        1197                1197         852                 852      android.widget.TextView        False                                 android.widget.TextView{d77de09 V.ED..... ........ 0,142-158,190 #7f080061 app:id/app_name_six}                False             1276               1118              876                828       11     True       True        False        loc: 17         d77de09       225959433        48                48          app:id/app_name_six         True             False   7f080061  2131230817           54              False               False            False            False                False                      False               False             False          id/app_name_six                    False                  False             V      158              158     1276               158       1118                   0      876               190        828                 142  x:1197 y: 852 t:1  x:1197 y: 852  x:1197 y: 852 t:1  x:1197 y: 852   x:1197 y: 852 t:1   x:1197 y: 852   x:1197 y: 852 t:1   x:1197 y: 852  x:1197 y: 852 t:1  x:1197 y: 852  x:1197 y: 852 t:1  x:1197 y: 852  x:1197 y: 852          x:1197 y: 852 t:1          x:1197 y: 852   x:1197 y: 852 t:1   x:1197 y: 852      x:1197 y: 852 t:1      x:1197 y: 852    x:1197 y: 852 t:1    x:1197 y: 852          51          30          28          26          24           6           5           4           3           2           0           1        <NA>        <NA>        <NA>        <NA>        <NA>        <NA>        <NA>
# 18              18                  1   30210    (324, 686, 483, 876)         403                 403         781                 781  android.widget.LinearLayout         True                        android.widget.LinearLayout{d7ec186 VFE...C.. .......D 66,0-225,190 #7f080050 app:id/appOneLinearLayout}                False              483                324              876                686       10    False       True         True        loc: 18         d7ec186       226410886       190               190    app:id/appOneLinearLayout         True             False   7f080050  2131230800           31              False                True            False            False                False                      False               False             False    id/appOneLinearLayout                    False                  False             V      159              159      483               225        324                  66      876               190        686                   0  x: 403 y: 781 t:1  x: 403 y: 781  x: 403 y: 781 t:1  x: 403 y: 781   x: 403 y: 781 t:1   x: 403 y: 781   x: 403 y: 781 t:1   x: 403 y: 781  x: 403 y: 781 t:1  x: 403 y: 781  x: 403 y: 781 t:1  x: 403 y: 781  x: 403 y: 781          x: 403 y: 781 t:1          x: 403 y: 781   x: 403 y: 781 t:1   x: 403 y: 781      x: 403 y: 781 t:1      x: 403 y: 781    x: 403 y: 781 t:1    x: 403 y: 781          30          28          26          24           6           5           4           3           2           0           1           1        <NA>        <NA>        <NA>        <NA>        <NA>        <NA>        <NA>
# 19              19                  1   30210    (483, 686, 642, 876)         562                 562         781                 781  android.widget.LinearLayout         True                       android.widget.LinearLayout{af57012 VFE...C.. .......D 225,0-384,190 #7f080053 app:id/appTwoLinearLayout}                False              642                483              876                686       10    False       True         True        loc: 19         af57012       183857170       190               190    app:id/appTwoLinearLayout         True             False   7f080053  2131230803           35              False                True            False            False                False                      False               False             False    id/appTwoLinearLayout                    False                  False             V      159              159      642               384        483                 225      876               190        686                   0  x: 562 y: 781 t:1  x: 562 y: 781  x: 562 y: 781 t:1  x: 562 y: 781   x: 562 y: 781 t:1   x: 562 y: 781   x: 562 y: 781 t:1   x: 562 y: 781  x: 562 y: 781 t:1  x: 562 y: 781  x: 562 y: 781 t:1  x: 562 y: 781  x: 562 y: 781          x: 562 y: 781 t:1          x: 562 y: 781   x: 562 y: 781 t:1   x: 562 y: 781      x: 562 y: 781 t:1      x: 562 y: 781    x: 562 y: 781 t:1    x: 562 y: 781          30          28          26          24           6           5           4           3           2           0           1           1        <NA>        <NA>        <NA>        <NA>        <NA>        <NA>        <NA>
# 20              20                  1   30210    (642, 686, 801, 876)         721                 721         781                 781  android.widget.LinearLayout         True                     android.widget.LinearLayout{fb67b5e VFE...C.. .......D 384,0-543,190 #7f080052 app:id/appThreeLinearLayout}                False              801                642              876                686       10    False       True         True        loc: 20         fb67b5e       263617374       190               190  app:id/appThreeLinearLayout         True             False   7f080052  2131230802           39              False                True            False            False                False                      False               False             False  id/appThreeLinearLayout                    False                  False             V      159              159      801               543        642                 384      876               190        686                   0  x: 721 y: 781 t:1  x: 721 y: 781  x: 721 y: 781 t:1  x: 721 y: 781   x: 721 y: 781 t:1   x: 721 y: 781   x: 721 y: 781 t:1   x: 721 y: 781  x: 721 y: 781 t:1  x: 721 y: 781  x: 721 y: 781 t:1  x: 721 y: 781  x: 721 y: 781          x: 721 y: 781 t:1          x: 721 y: 781   x: 721 y: 781 t:1   x: 721 y: 781      x: 721 y: 781 t:1      x: 721 y: 781    x: 721 y: 781 t:1    x: 721 y: 781          30          28          26          24           6           5           4           3           2           0           1           1        <NA>        <NA>        <NA>        <NA>        <NA>        <NA>        <NA>