question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The appium-android-driver cannot unlock the screen on some devices

See original GitHub issue

@nghiadhd commented on Thu May 19 2016

Appium@1.5.2 Issue devices:

  1. Galaxy Note 3: Model: SM-N9005, version: 4.4.2
  2. Galaxy S4: Model: GT-I9500, version: 4.4.2
  3. HTC one: Model: HTC6525LVW, version: 5.0.1

Other devices still work well

Note: In the past, the Galaxy S4 still works well, but after upgrade to newer OS version, it doesn’t work any more

Issue: “Encountered internal error running command: Error: Screen did not unlock successfully” Expectation: The screen should be unlocked


After do some investigating, found that the adb command to start the unlock doesn’t work adb with args: ["-P",5037,"-s","xxxxxxxxxx","shell","am","start","-n","io.appium.unlock/.Unlock","-S","-a","android.intent.action.MAIN","-c","android.intent.category.LAUNCHER","-f","0x10200000"]

I can reproduce the issue by adb command

adb -s <UDID> shell am start -n ‘io.appium.unlock/.Unlock’ -S -a ‘android.intent.action.MAIN’ -c ‘android.intent.category.LAUNCHER’ -f ‘0x10200000’

Some addresses

The ‘-S’ option doesn’t work (should be remove from command) If the unlock is on foreground, the command doesn’t make effect

My solution, use ‘adb shell am force-stop’ to kill ‘unlock’ and ‘adb shell am start’ to restart ‘unlock’ app. I tested on issue devices and confirm it works well

adb -s <UDID>  shell am force-stop 'io.appium.unlock
adb -s <UDID>  shell am start -n 'io.appium.unlock/.Unlock' -a 'android.intent.action.MAIN' -c 'android.intent.category.LAUNCHER' -f '0x10200000'
adb -s <UDID>  shell am start -n 'io.appium.unlock/.Unlock' -a 'android.intent.action.MAIN' -c 'android.intent.category.LAUNCHER' -f '0x10200000'

Weird that after force-stop, we should call ‘am start’ 2 times to invoke the ‘unlock’ app. That’s should be the reason why ‘-S’ option doesn’t work


@imurchie commented on Fri May 20 2016

Interesting! Thank you for the detailed update. I’ll take a look at this!


@nghiadhd commented on Mon May 23 2016

Thank @imurchie

That’s seem a critical issue. The test script always failed if the screen cannot unlocked


@rkavalap commented on Mon Aug 01 2016

+1

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

0reactions
lock[bot]commented, Apr 26, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Appium unlock does not work on some devices [Android]
Hi all. I have an issue with appium unlock on android. It works on 50% of devices. It tries to unlock but unsuccessfully....
Read more >
Unable to unlock device as first teststep - Katalon Studio
I am trying to figure out how to start a Katalon Mobile test with Appium on an Android Device which is locked automatically...
Read more >
Appium: How to handle device lock and unlock actions for ...
AndroidDriver provides the following methods to lock, unlock and check lock status of the device isDeviceLocked() , lockDevice() and unlockDevice() .
Read more >
Troubleshooting when Testing Mobile Applications
Why does the Select Application dialog not display my mobile devices? ; The emulator is not running. Start the emulator. ; The Android...
Read more >
appium-espresso-driver
Appium's Espresso Driver is a test automation server for Android ... By default Espresso driver tries to detect if the device's screen is ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found