I have a task that I need to write Android mobile test automation using Appium and selenium in Java.I have to do scenario that phone has to be unlock using PINCODE pro-grammatical way.
Is there anyway to unlock android mobile in automation tests using pincode? Can anyone give me any suggestions to do this task.
There is no capability in Appium to unlock the pattern/pin lock though appium can wake our device up. To lock/Unlock the screen we need to use ADB commands, below are few examples you can give a try to:
To wake the device from sleep mode
adb shell input keyevent KEYCODE_POWER
To swipe up for obtainging the PIN screen
adb shell input swipe 800 400 400 400
Enter PIN
adb shell input text 0000
Tap on Enter to unlock
adb shell input keyevent KEYCODE_ENTER
Related
I have an Android TV for which I want to turn the display on and off based on a motion sensor. I have connected the tv to a raspberry pi via Wifi and I'm trying now via adb commands to turn off the display of the Android TV.
As far as I've seen, I need to execute the following command:
./adb shell input keyevent 26
Unfortunately, this also turns down the device and most importantly Wifi. After this the TV is offline and not reachable anymore via the IP address. So I have to use the remote to turn it on again.
So I need a way to keep the Wifi active. I've already tried the following commands without luck:
adb shell svc power stayon true
adb shell settings put global stay_on_while_plugged_in 3
I've also sideloaded a Wakelock app, but that also didn't work. After keyevent 26, the device is always offline.
The TV is a TCL 43P615.
Any ideas how I could achieve this?
Thanks
There would not be a standard way of turning off the screen (https://support.google.com/androidtv/thread/58069060/is-it-possible-to-turn-screen-off?hl=en-GB) but perhaps your TV provides one in settings or eco-mode.
Perhaps you best bet is to disable the screensaver and create a completely black fullscreen Activity that you can start and stop from adb.
I modified android phone hdmi output properties using ADB commands below
adb shell setprop persist.demo.rotationlock false
adb shell setprop persist.demo.singledisplay true
In order to see the change,
I will have to do either one of the following.
turn off phone screen, then turn on phone screen.
restart the phone or tv
unplug the phone to monitor, then plug the phone to monitor.
What I want:
Is there any command to do a quick reload/reset/refresh phone screen or video output connection? so I don't have to do any of the above to see the change.
Any help is appreciated
To "turn off phone screen, then turn on phone screen":
adb shell input keyevent 26
Run the above command twice.
26 is the keyevent code for power button.
To "restart phone":
adb reboot
Hello I would like to know the adb command to unlock the swipe lock in any android phone using some commands irrespective of the device.
Thank You
adb shell su 0 service call window 49 would call WindowManager.dismissKeyguard() in Android 5.1+
Can you simulate IME_ACTION_DONE commands on the adb shell?
I have used this but it does not work
adb shell input ime IME_ACTION_DONE
I am trying to use this system command on my calabash test by running the above command using the system function
Use the Calabash-Android method press_user_action_button to simulate these interactions. Notice that your application should still handle enter keys (e.g. press_enter_button) as some phones will have a physical or bluetooth keyboard connected.
I'm (trying) to use Analog Keyboard for Android Wear from Microsoft Research.
The wearable (Moto360) is properly setup for Bluetooth debugging and the install procedure for the Keyboard finishes as expected:
$ adb devices
List of devices attached
4df11bb241805f93 device
localhost:4444 device
$ adb -e install com.microsoft.research.analogkeyboard-Signed.apk
50 KB/s (5322694 bytes in 103.401s)
pkg: /data/local/tmp/com.microsoft.research.analogkeyboard-Signed.apk
Success
$ adb -e shell ime enable com.microsoft.research.analogkeyboard/.KeyboardService
Input method com.microsoft.research.analogkeyboard/.KeyboardService: now enabled
$ adb -e shell ime set com.microsoft.research.analogkeyboard/.KeyboardService
Input method com.microsoft.research.analogkeyboard/.KeyboardService selected
After that, the Analog Keyboard app is visible in the list of installed apps on the watch and, when opened, works really fine.
The challenge is to make it replace voice commands. Is that possible?
No, it is not possible to intercept or change the voice input mechanisms used throughout Android Wear.