Package: getevent-sendevent
Sending touch/swipe events to BlueStacks/Android sounds easy but actually it isn'tThere are some "common ways"1st way:The standard version on a not rooted system is:adb shell input tap x yUnfortunately, this method is very slow and unreliable since it calls the Java layer of the android framework:https://stackoverflow.com/a/38806872/150962472nd way:If your cell phone / BlueStacks instance is rooted, you can use:adb shell sendevent /dev/input/event2 3 0 xadb shell sendevent /dev/input/event2 3 1 yadb shell sendevent /dev/input/event2 1 330 1adb shell sendevent /dev/input/event2 0 0 0adb shell sendevent /dev/input/event2 1 330 0adb shell sendevent /dev/input/event2 0 0 0This method is a lot better than "input tap" since it is more reliable and slightly faster.But when you use "sendevent" like in the example above, you won't even get a decent swipe, becausethe break between the ADB shell calls just takes too long.Even using:adb shell "sendevent1 ; sendevent2 ; sendevent3 ; …"doesn’t improve the executing speed much.3rd way:If your cell phone / BlueStacks instance is rooted, you can also use:adb shell dd bs=filesize_in_bytes  if=./file of=/dev/input/eventXThis method is very reliable and very very very fast… unfortunately too fast for the Android touch screen.sendevent-getevent aims to offer a solution for the execution speed problem.Features:You can record getevents directly from python, once you are done you press the hotkey (default=“ctrl+x”) to exit the recording session.It converts the output into all possible formats: hex - int - sendevent with int - binary data and returns a Pandas DataFrameYou can define the playback speed of the recorded session (speed 4 is about close to the "original speed")You can change the playback speed afterwardsIt is possible to save/load recorded sessionsYou can manually change the DataFrameIt sends chunked data to the device/emulator using adb shell dd bs=filesize_in_bytes  if=./file of=/dev/input/eventX , and sleeps after each chunkTested against Windows 10 / Python 3.9.13 / BlueStacks 5It should also work with any rooted Android device, the only problem might be the "bluestacks_divider".https://stackoverflow.com/a/73733261/15096247But changing the code (if necessary) shouldn't be a big thing.Since my cell phone is not rooted, and I have no intention of rooting it, I cannot test it with an physical Android device. (I would be grateful for any feedback)Take a look at the video to see what the code below does:https://www.youtube.com/watch?v=BNDtruH6frI$pipinstallgetevent-sendeventfromgetevent_sendeventimportGetEventSendEventimportpandasaspd# creating an instancegetsend=GetEventSendEvent(adb_path="C:\\Users\\Gamer\\AppData\\Local\\Android\\Sdk\\platform-tools\\adb.exe",deviceserial="localhost:5735",sdcard="/storage/emulated/0/",# it is probably better to pass the path, not the symlinktemfolder_on_sd_card="AUTOMAT",# if the folder doesn't exist, it will be createdbluestacks_divider=32767,exit_keys="ctrl+x",# stop the recording session)# connect to adbgetsend.connect_to_adb()# start a recording sessiondf=getsend.record_events_and_convert_to_df(playbackspeed=3)# execute the recorded commandgetsend.execute_recorded_events(df,structfolder="struct",additional_end_command=True,remove_temp_files_from_device=False,)# increasing the execution speeddf_fast=pd.DataFrame()forspeed_inrange(4,16):df_fast=getsend.change_playback_speed(df,playback_speed=speed_)getsend.execute_recorded_events(df_fast,structfolder="struct",additional_end_command=True,remove_temp_files_from_device=False,# Repeated execution will be faster, but you should clean the folder /storage/emulated/0/AUTOMAT every once in a while)# executing the same command over and over again without creating a new DataFrameforspeed_inrange(4,16):getsend.execute_recorded_events(df_fast,structfolder="struct",# binary dataadditional_end_command=True,remove_temp_files_from_device=False,)# Saving the recorded sessiongetsend.save_recorded_data_on_hdd(df,path="f:\\testfoldersendevent\\saveddata.txt")# Loading it again and redefine the playback speeddfloaded=getsend.load_recoded_data(path="f:\\testfoldersendevent\\saveddata.txt",playback_speed=16)# Executing the loaded sessiongetsend.execute_recorded_events(dfloaded,structfolder="struct",additional_end_command=True,remove_temp_files_from_device=False,)HereistheDataFrame:aa_timeaa_deviceaa_typeaa_codeaa_valueaa_device_nameaa_value_intaa_code_intaa_type_intaa_time_difference_startaa_time_diff_actionsaa_real_coordsaa_send_eventaa_send_event_real_ccordsaa_time_newaa_structaa_struct_realaa_struct_sizeaa_struct_real_sizeaa_struct_togetheraa_struct_real_togetherstruct_tmp_hdd_full_pathstruct_tmp_hddstruct_tmp_folderstruct_filenamestruct_real_tmp_hdd_full_pathstruct_real_tmp_hddstruct_real_tmp_folderstruct_real_filenamestruct_copy_dvstruct_real_copy_dvrandom_sleepaa_copy_struct_to_hddaa_copy_struct_real_to_hddstruct_folder_androidstruct_real_folder_androidstruct_file_androidstruct_real_file_androidaa_copy_struct_to_hdd_success030922..../dev/i...EV_ABSABS_MT...0000769fBlueSt...303675330.00.0889sendev...sendev...1b'\x01...  b'\x03...352352b'\x01...          b'\x03...C:\Use...C:\Use...tmpcgn...struct...C:\Use...C:\Use...tmpqeh...struct...ddbs=...ddbs=...0.0__main...__main.../stora.../stora.../stora.../stora...True130922..../dev/i...EV_ABSABS_MT...00005974BlueSt...229005430.00.0377sendev...sendev...1b'\x01...  b'\x03...352352<NA><NA>C:\Use...<NA>tmpcgn...NoneC:\Use...<NA>tmpqeh...None<NA><NA>0.0NaNNaN/stora.../stora...NaNNaNNaN230922..../dev/i...EV_SYNSYN_MT...00000000BlueSt...0200.00.00sendev...sendev...1b'\x01...  b'\x03...352352<NA><NA>C:\Use...<NA>tmpcgn...NoneC:\Use...<NA>tmpqeh...None<NA><NA>0.0NaNNaN/stora.../stora...NaNNaNNaN330922..../dev/i...EV_SYNSYN_RE...00000000BlueSt...0000.00.0123150sendev...sendev...1b'\x01...  b'\x03...352352<NA><NA>C:\Use...<NA>tmpcgn...NoneC:\Use...<NA>tmpqeh...None<NA><NA>0.012315NaNNaN/stora.../stora...NaNNaNNaN430922..../dev/i...EV_ABSABS_MT...0000769fBlueSt...303675330.0123150.0889sendev...sendev...1b'\x01...  b'\x03...352352<NA><NA>C:\Use...<NA>tmpcgn...NoneC:\Use...<NA>tmpqeh...None<NA><NA>0.0NaNNaN/stora.../stora...NaNNaNNaN530922..../dev/i...EV_ABSABS_MT...00005974BlueSt...229005430.0123150.0377sendev...sendev...1b'\x01...  b'\x03...352352<NA><NA>C:\Use...<NA>tmpcgn...NoneC:\Use...<NA>tmpqeh...None<NA><NA>0.0NaNNaN/stora.../stora...NaNNaNNaN....