2016-06-03 8 views
1

У меня проблема с разблокировкой appium на Android. Он работает на 50% устройств. Он пытается разблокировать, но безуспешно.Appium unlock не работает на некоторых устройствах [Android]

Мои возможности:

DesiredCapabilities capabilities = new DesiredCapabilities(); 

     capabilities.setCapability(APP, APP_PATH_LOCAL); //TODO LOCAL 
//  capabilities.setCapability(APP, APP_PATH_REMOTE); //TODO REMOTE 
     capabilities.setCapability(AndroidMobileCapabilityType.APP_PACKAGE, F_APP_PACKAGE); 
     capabilities.setCapability(AndroidMobileCapabilityType.APP_ACTIVITY, F_APP_ACTIVITY); 
     capabilities.setCapability(DEVICE_NAME, deviceName); 
     capabilities.setCapability(UDID, id); 
     capabilities.setCapability(NEW_COMMAND_TIMEOUT, 20); 
     capabilities.setCapability(PLATFORM_NAME, "ANDROID"); 
     androidDriver = new AndroidDriver(new URL(LOCAL), capabilities); //TODO LOCAL 
//   androidDriver = new AndroidDriver(new URL(REMOTE), capabilities); //TODO REMOTE 

TestNG пиловочник:

O rg.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: Screen did not unlock successfully, retrying (WARNING: The server did not provide any stacktrace information)

журналы Appium:

[AndroidDriver] Starting Android session 
[debug] [ADB] Running /home/igor/Android/Sdk/platform-tools/adb with args: ["-P",5037,"-s","4d009d021274404b","wait-for-device"] 
[debug] [ADB] Getting connected devices... 
[debug] [ADB] 1 device(s) connected 
[debug] [ADB] Running /home/igor/Android/Sdk/platform-tools/adb with args: ["-P",5037,"-s","4d009d021274404b","shell","echo","ping"] 
[debug] [Logcat] Starting logcat capture 
[debug] [AndroidDriver] Pushing settings apk to device... 
[debug] [ADB] Running /home/igor/Android/Sdk/platform-tools/adb with args: ["-P",5037,"-s","4d009d021274404b","install","/home/igor/Node/node-v4.4.3-linux-x64/lib/node_modules/appium/node_modules/appium-android-driver/node_modules/io.appium.settings/bin/settings_apk-debug.apk"] 
[debug] [AndroidDriver] Pushing unlock helper app to device... 
[debug] [ADB] Running /home/igor/Android/Sdk/platform-tools/adb with args: ["-P",5037,"-s","4d009d021274404b","install","/home/igor/Node/node-v4.4.3-linux-x64/lib/node_modules/appium/node_modules/appium-android-driver/node_modules/appium-unlock/bin/unlock_apk-debug.apk"] 
[ADB] Getting device platform version 
[debug] [ADB] Getting connected devices... 
[debug] [ADB] 1 device(s) connected 
[debug] [ADB] Running /home/igor/Android/Sdk/platform-tools/adb with args: ["-P",5037,"-s","4d009d021274404b","shell","getprop","ro.build.version.release"] 
[debug] [ADB] Getting connected devices... 
[debug] [ADB] 1 device(s) connected 
[debug] [ADB] Running /home/igor/Android/Sdk/platform-tools/adb with args: ["-P",5037,"-s","4d009d021274404b","shell","dumpsys","window"] 
[AndroidDriver] Unlocking screen 
[debug] [AndroidDriver] Screen is locked, trying to unlock 
[debug] [ADB] Getting connected devices... 
[debug] [ADB] 1 device(s) connected 
[debug] [ADB] Running /home/igor/Android/Sdk/platform-tools/adb with args: ["-P",5037,"-s","4d009d021274404b","shell","getprop","ro.build.version.sdk"] 
[debug] [ADB] Device API level: 21 
[debug] [ADB] Getting connected devices... 
[debug] [ADB] 1 device(s) connected 
[debug] [ADB] Running /home/igor/Android/Sdk/platform-tools/adb with args: ["-P",5037,"-s","4d009d021274404b","shell","am","start","-n","io.appium.unlock/.Unlock","-S","-a","android.intent.action.MAIN","-c","android.intent.category.LAUNCHER","-f","0x10200000"] 
[debug] [ADB] Getting connected devices... 
[debug] [ADB] 1 device(s) connected 
[debug] [ADB] Running /home/igor/Android/Sdk/platform-tools/adb with args: ["-P",5037,"-s","4d009d021274404b","shell","dumpsys","window"] 
[debug] [AndroidDriver] Screen is locked, trying to unlock 
[debug] [ADB] Device API level: 21 
[debug] [ADB] Getting connected devices... 
[debug] [ADB] 1 device(s) connected 
[debug] [ADB] Running /home/igor/Android/Sdk/platform-tools/adb with args: ["-P",5037,"-s","4d009d021274404b","shell","am","start","-n","io.appium.unlock/.Unlock","-S","-a","android.intent.action.MAIN","-c","android.intent.category.LAUNCHER","-f","0x10200000"] 
[debug] [ADB] Getting connected devices... 
[debug] [ADB] 1 device(s) connected 
[debug] [ADB] Running /home/igor/Android/Sdk/platform-tools/adb with args: ["-P",5037,"-s","4d009d021274404b","shell","dumpsys","window"] 
[debug] [AndroidDriver] Screen is locked, trying to unlock 
[debug] [ADB] Device API level: 21 
[debug] [ADB] Getting connected devices... 
[debug] [ADB] 1 device(s) connected 
[debug] [ADB] Running /home/igor/Android/Sdk/platform-tools/adb with args: ["-P",5037,"-s","4d009d021274404b","shell","am","start","-n","io.appium.unlock/.Unlock","-S","-a","android.intent.action.MAIN","-c","android.intent.category.LAUNCHER","-f","0x10200000"] 
[debug] [ADB] Getting connected devices... 
[debug] [ADB] 1 device(s) connected 
[debug] [ADB] Running /home/igor/Android/Sdk/platform-tools/adb with args: ["-P",5037,"-s","4d009d021274404b","shell","dumpsys","window"] 
[debug] [AndroidDriver] Screen is locked, trying to unlock 
[debug] [ADB] Device API level: 21 
[debug] [ADB] Getting connected devices... 
[debug] [ADB] 1 device(s) connected 
[debug] [ADB] Running /home/igor/Android/Sdk/platform-tools/adb with args: ["-P",5037,"-s","4d009d021274404b","shell","am","start","-n","io.appium.unlock/.Unlock","-S","-a","android.intent.action.MAIN","-c","android.intent.category.LAUNCHER","-f","0x10200000"] 
[debug] [ADB] Getting connected devices... 
[debug] [ADB] 1 device(s) connected 
[debug] [ADB] Running /home/igor/Android/Sdk/platform-tools/adb with args: ["-P",5037,"-s","4d009d021274404b","shell","dumpsys","window"] 
[debug] [AndroidDriver] Screen is locked, trying to unlock 
[debug] [ADB] Device API level: 21 
[debug] [ADB] Getting connected devices... 
[debug] [ADB] 1 device(s) connected 
[debug] [ADB] Running /home/igor/Android/Sdk/platform-tools/adb with args: ["-P",5037,"-s","4d009d021274404b","shell","am","start","-n","io.appium.unlock/.Unlock","-S","-a","android.intent.action.MAIN","-c","android.intent.category.LAUNCHER","-f","0x10200000"] 
[debug] [ADB] Getting connected devices... 
[debug] [ADB] 1 device(s) connected 
[debug] [ADB] Running /home/igor/Android/Sdk/platform-tools/adb with args: ["-P",5037,"-s","4d009d021274404b","shell","dumpsys","window"] 
[debug] [AndroidDriver] Screen is locked, trying to unlock 
[debug] [ADB] Device API level: 21 
[debug] [ADB] Getting connected devices... 
[debug] [ADB] 1 device(s) connected 
[debug] [ADB] Running /home/igor/Android/Sdk/platform-tools/adb with args: ["-P",5037,"-s","4d009d021274404b","shell","am","start","-n","io.appium.unlock/.Unlock","-S","-a","android.intent.action.MAIN","-c","android.intent.category.LAUNCHER","-f","0x10200000"] 
[debug] [ADB] Getting connected devices... 
[debug] [ADB] 1 device(s) connected 
[debug] [ADB] Running /home/igor/Android/Sdk/platform-tools/adb with args: ["-P",5037,"-s","4d009d021274404b","shell","dumpsys","window"] 
[debug] [AndroidDriver] Screen is locked, trying to unlock 
[debug] [ADB] Device API level: 21 
[debug] [ADB] Getting connected devices... 
[debug] [ADB] 1 device(s) connected 
[debug] [ADB] Running /home/igor/Android/Sdk/platform-tools/adb with args: ["-P",5037,"-s","4d009d021274404b","shell","am","start","-n","io.appium.unlock/.Unlock","-S","-a","android.intent.action.MAIN","-c","android.intent.category.LAUNCHER","-f","0x10200000"] 
[debug] [ADB] Getting connected devices... 
[debug] [ADB] 1 device(s) connected 
[debug] [ADB] Running /home/igor/Android/Sdk/platform-tools/adb with args: ["-P",5037,"-s","4d009d021274404b","shell","dumpsys","window"] 
[debug] [AndroidDriver] Screen is locked, trying to unlock 
[debug] [ADB] Device API level: 21 
[debug] [ADB] Getting connected devices... 
[debug] [ADB] 1 device(s) connected 
[debug] [ADB] Running /home/igor/Android/Sdk/platform-tools/adb with args: ["-P",5037,"-s","4d009d021274404b","shell","am","start","-n","io.appium.unlock/.Unlock","-S","-a","android.intent.action.MAIN","-c","android.intent.category.LAUNCHER","-f","0x10200000"] 
[debug] [ADB] Getting connected devices... 
[debug] [ADB] 1 device(s) connected 
[debug] [ADB] Running /home/igor/Android/Sdk/platform-tools/adb with args: ["-P",5037,"-s","4d009d021274404b","shell","dumpsys","window"] 
[debug] [AndroidDriver] Screen is locked, trying to unlock 
[debug] [ADB] Device API level: 21 
[debug] [ADB] Getting connected devices... 
[debug] [ADB] 1 device(s) connected 
[debug] [ADB] Running /home/igor/Android/Sdk/platform-tools/adb with args: ["-P",5037,"-s","4d009d021274404b","shell","am","start","-n","io.appium.unlock/.Unlock","-S","-a","android.intent.action.MAIN","-c","android.intent.category.LAUNCHER","-f","0x10200000"] 
[debug] [ADB] Getting connected devices... 
[debug] [ADB] 1 device(s) connected 
[debug] [ADB] Running /home/igor/Android/Sdk/platform-tools/adb with args: ["-P",5037,"-s","4d009d021274404b","shell","dumpsys","window"] 
[debug] [AndroidDriver] Screen is locked, trying to unlock 
[debug] [ADB] Device API level: 21 
[debug] [ADB] Getting connected devices... 
[debug] [ADB] 1 device(s) connected 
[debug] [ADB] Running /home/igor/Android/Sdk/platform-tools/adb with args: ["-P",5037,"-s","4d009d021274404b","shell","am","start","-n","io.appium.unlock/.Unlock","-S","-a","android.intent.action.MAIN","-c","android.intent.category.LAUNCHER","-f","0x10200000"] 
[debug] [ADB] Getting connected devices... 
[debug] [ADB] 1 device(s) connected 
[debug] [ADB] Running /home/igor/Android/Sdk/platform-tools/adb with args: ["-P",5037,"-s","4d009d021274404b","shell","dumpsys","window"] 
[debug] [AndroidDriver] Shutting down Android driver 
[AndroidDriver] Cannot shut down Android driver; it has already shut down 
[MJSONWP] Encountered internal error running command: Error: Screen did not unlock successfully, retrying 
    at Object.callee$1$0$ (lib/android-helpers.js:348:13) 
    at tryCatch (/home/igor/Node/node-v4.4.3-linux-x64/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40) 
    at GeneratorFunctionPrototype.invoke [as _invoke] (/home/igor/Node/node-v4.4.3-linux-x64/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22) 
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/home/igor/Node/node-v4.4.3-linux-x64/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21) 
    at GeneratorFunctionPrototype.invoke (/home/igor/Node/node-v4.4.3-linux-x64/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37) 
    at run (/home/igor/Node/node-v4.4.3-linux-x64/lib/node_modules/appium/node_modules/babel-runtime/node_modules/core-js/library/modules/es6.promise.js:104:47) 
    at /home/igor/Node/node-v4.4.3-linux-x64/lib/node_modules/appium/node_modules/babel-runtime/node_modules/core-js/library/modules/es6.promise.js:115:28 
    at flush (/home/igor/Node/node-v4.4.3-linux-x64/lib/node_modules/appium/node_modules/babel-runtime/node_modules/core-js/library/modules/$.microtask.js:19:5) 
    at nextTickCallbackWith0Args (node.js:420:9) 
    at process._tickCallback (node.js:349:13) 
[HTTP] <-- POST /wd/hub/session 500 43019 ms - 181 

Я пытался разблокировать устройство программно от ADB с помощью этого метода:

public void unlockDevice() throws Exception { 
     Runtime.getRuntime().exec("adb shell input keyevent 26"); 
    } 

Но это не делать ничего

Может быть, его можно нажать кнопку питания, используя androidDriver перед установкой возможности? androidDriver.pressKeyCode (26); Или можно запустить команду adb из кода с помощью Java? Или что-то еще, чтобы разблокировать устройство?

+0

Вы должны дать ему вид: Существует проблема в https://github.com/appium/appium-android-driver/issues/146, который с участием ваш вопрос. Вы можете попробовать обновить новую версию [appium-android-driver] (https://www.npmjs.com/package/appium-android-driver). – phuongle

ответ

0

Вы должны начать свою деятельность:

adb shell am start -n io.appium.unlock/.Unlock 
+0

Разблокировка Appium, установленная на Appium 1.5.3. Но спасибо за ответ – ZeitNot

+0

счастлив, что он решен, добро пожаловать :) – Emna