I’d also like to wake up the device if it is not awake. I see there is a wake.apk installed on the device, but I can’t find an example of how to call it.
@kirill, appium doesn’t support direct access to adb, so you would need to use
appium.driver.press_keycode 26
Similarly, 82 can be used to unlock, assuming there is no passcode on the lock screen. But simulating these key presses doesn’t work if I can’t detect if the screen is off or not. If it’s on and I press the power button (26), I would turn it off, and then I can’t unlock by using the unlock key code.
Sorry, I don’t get wha is the problem…
What language are you using?
For example on Ruby in your code to execute bash command you do like that:
`adb shell input keyevent 26`
or
system("adb shell input keyevent 26")
Just create the method like press_lock_button which contain this single line. It is readable. Doesn’t require any support. You could provide UDID though… It is simple and available for everyone.
Sorry, if I got you wrong… Let me know, I will try to figure out how to do that in different way
Hey Guys, I was trying to run my script over multiple devices In parallel But this Unlocking thing is causing hurdle for me:
Here it is like:
When I keep my devices unlocked only then script runs in parallel but as soon as my devices are locked then script run one by one on each devices (First unlocking screen in one devices and run script and then same follows on second devices)
My usecase is to achieve parallelism without manually unlocking devices.
@Shankeyisgem, I’d love to hear more about how you are running everything in parallel over a single script, and it also might help up debug your problem.
In the mean time, you can set your device to never sleep (which is what I assume you mean by locking) if you set “Developer Options”-> “Stay Awake” to true
Thanks for your response. It is combination of selenium Grid and my devices registration with this.
So Here It is:
Making sure my Selenium grid is up and running
Then registering Node android devices with Grid (Having a bat file for the nodes).
Then In eclipse Passing my Script to Testng.XML
and with all this, I am able to achieve parallelism but only when my devices are not locked (Awake) but problem starts with devices locked and then Parallelism fails.
This is not my area of expertise, but it seems right to me. It would be interesting to compare the appium server logs in a successful vs. unsuccessful scenario. As I said in my last post, my likely solution would be to disable device locking.