When using -wipe-data in avdArgs the noReset capability will be ignored if set to true.
After setting power state to off (e.g.: tPowerAC(PowerACState.OFF) ) you must create a new session.Make sure you set ANDROID_HOME pointing to the Android SDK directory.If you're running the Android emulator using Fastboot and the emulator isn't being detected by adb, try doing a cold boot: Android Studio > Tools > AVD Manager > Actions > Cold Boot Now.Reset the connection to the Android device. It's sometimes useful to run adb kill-server & adb devices.
How To Execute Shell Commands On The Remote Device.Activities Startup Troubleshooting Guide.Low-Level Insights on Android Input Events.