I want to test application when battery is low. Is it possible to change battery level using Appium?
created
Feb '16
last reply
Oct '17
- 5
replies
- 1.6k
views
- 3
users
- 2
likes
I want to test application when battery is low. Is it possible to change battery level using Appium?
If you are running your test case locally, you can call adb. The following two commands can be used to change the battery level and update the rest of the system:
adb shell am broadcast -a android.intent.action.BATTERY_CHANGED --ei status 3 --ei level --ei scale 100
adb shell am broadcast -a android.intent.action.BATTERY_LOW
Hi ,
i have a question on this issue , i need to change the battery charging state to discharging in the Intent.ACTION_BATTERY_CHANGE ( i need to run a test , that the phone is not charge but i use usb that charge the phone) , i try to use adb commands like "“adb shell am broadcast -a android.intent.action.BATTERY_CHANGED --ez present false --ei state 3 --ei level 40 --ei plugged 0” or “adb shell dumpsys battery set status 3 | set usb 0” but the intent isn’t change , can appium help with that or there is another way to handle this issue?