Lock screen on Android Emulator

549 views
Skip to first unread message

jib jip

unread,
Aug 27, 2014, 1:05:35 AM8/27/14
to appium-...@googlegroups.com
I would like to lock screen on Android emulator by remote through Appium 
I use this command: ((JavascriptExecutor)driver).executeScript("mobile: lock", new HashMap<String, Double>() {{put("touchCount", (double) 1); put("seconds", (double) 1);}});
And I got this error:   org.openqa.selenium.WebDriverException: Not yet implemented. Please help us: http://appium.io/get-involved.html (WARNING: The server did not provide any stacktrace information)
      Command duration or timeout: 3 milliseconds 

Isaac Murchie

unread,
Aug 27, 2014, 11:48:57 AM8/27/14
to jib jip, appium-...@googlegroups.com
A native method for locking Android is in the works. See the comments on https://github.com/appium/appium/pull/3464

At the moment it is only possible by sending a key event 26, which is the power button, either with the methods for sending key events, or directly through adb (as in https://github.com/appium/appium/blob/master/test/functional/android/device-state-specs.js#L31)


--
http://appium.io
---
You received this message because you are subscribed to the Google Groups "Appium-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to appium-discus...@googlegroups.com.
Visit this group at http://groups.google.com/group/appium-discuss.
For more options, visit https://groups.google.com/d/optout.

Isaac Murchie

unread,
Aug 28, 2014, 12:10:51 PM8/28/14
to joopjib jip, appium-...@googlegroups.com
Please keep this on the Appium Discuss list.

Your Appium client library ought to have a method to do the key event. In Python, it is "driver.press_keycode(26)". Other clients you'll have to check their documentation.


On Wed, Aug 27, 2014 at 7:40 PM, joopjib jip <joopj...@gmail.com> wrote:
I used this command: ((JavascriptExecutor)driver).executeScript("mobile: keyevent", new HashMap<String, Double>() {{put(" keycode", (double) 26);}}); but it still has the same error 

org.openqa.selenium.WebDriverException: Not yet implemented. Please help us: http://appium.io/get-involved.html (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 6 milliseconds
Reply all
Reply to author
Forward
0 new messages