appium: Unlocking an Android screen when "Screen lock type" is None does not work

Unlock screen does not work when “Screen lock type” is None

When using Appium 1.7.1 and starting Android settings, the Appium thinks that it is not able to unlock the screen. I have this code:

from appium import webdriver

settings_caps = {"appPackage": "com.android.settings",
                 "appActivity": ".Settings",
                 "platformName": "android",
                 "platformVersion": "7.0",
                 "deviceName": "Galaxy J5 (2017)"}

driver = webdriver.Remote('http://localhost:4723/wd/hub', settings_caps)
driver.quit()

Then I see this in the logs: https://gist.github.com/aaltat/15db505eb62bc5e1096de264a8648156

Environment

  • Appium@1.7.1 and 1.7.0
  • The problem does not occur in Appium@1.6.5:
  • Running on Windows 7:
  • Running NodeJs: v6.9.2
  • Android 7.0
  • Running reals device: Samsung J5 (2017)

Details

When running the code above, I see that screen unlock but for some reason the Appium server thinks that it can not unlock the screen.

Link to Appium logs

Log from the Appium server are here: https://gist.github.com/aaltat/15db505eb62bc5e1096de264a8648156

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 19 (2 by maintainers)

Most upvoted comments

I have tried using the below code to unlock the device: cap.setCapability(“deviceName”, “Redmi”); cap.setCapability(“platformName”, “Andorid”); cap.setCapability(“platformVersion”, “6.0.1”); cap.setCapability(“unlockType”, “pin”); cap.setCapability(“unlockKey”, “1111”); cap.setCapability(“appPackage”, “com.miui.player”); cap.setCapability(“appActivity”, “com.miui.player.ui.MusicBrowserActivity”);

still I am getting the following error in appium logs: Encountered internal error running command: Error: Error finding unlock pin buttons!

Please help to resolve this issue.

@mykola-mokhnach already working on a solution. https://github.com/appium/appium-android-driver/compare/master...vrunoa:add-swipe-to-unlock We just need to swipe to unlock or use dismiss keyguard, already working on 5.1 and above, but something seems to be happing with 4.4 and touch actions. I’ll try to have this fixed for the end of the week. Let me know if you guys would like a first ship on this solution for 5.1 and above, and in a next stage we add 4.4.