首页 新闻 搜索 专区 学院

appium 测试 H5 的时候出现以下报错

0
[已解决问题] 解决于 2018-09-28 10:43

python后台报错

    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the comma
nd. Original error: Cannot start the 'com.wondershare.drfone' application. Original error: Error executing adbExec. Orig
inal error: 'Command 'D\:\\Andriod_SDK\\platform-tools\\adb.exe -P 5037 -s 127.0.0.1\:21503 shell am start -W -n com.won
dershare.drfone/com.wondershare.drfone.ui.activity.WelcomeActivity -S' timed out after 20000ms'; Stderr: ''; Code: 'null'

测试环境

1.测试设备:逍遥模拟器 Android 5.1.1 /Chrome 66.0
2.PC系统环境: Win7 32bit /Chrome 66.0

测试代码

from appium import webdriver
from selenium.webdriver.support.ui import WebDriverWait

desired_caps={}
desired_caps['platformName']='Android'
desired_caps['platformVersion']='5.1.1'
desired_caps['deviceName']='127.0.0.1:21503'
desired_caps['app']='C:\pyln\dr.fone3.2.0.apk'
desired_caps['appPackage']='com.wondershare.drfone'
desired_caps['appActivity']='com.wondershare.drfone.ui.activity.WelcomeActivity'
driver = webdriver.Remote('http://localhost:4723/wd/hub',desired_caps)
driver.implicitly_wait(5)

print('click BackupBtn')
driver.find_element_by_id('com.wondershare.drfone:id/btnBackup').click()
WebDriverWait(driver,8).until(lambda x:x.find_element_by_id('com.wondershare.drfone:id/btnRecoverData'))
print('click NextBtn')
driver.find_element_by_id('com.wondershare.drfone:id/btnRecoverData').click()

WebDriverWait(driver,8).until(lambda x:x.find_element_by_class_name('android.webkit.WebView'))
contexts=driver.contexts
print(contexts)

appium错误日志

[info] [Appium] Welcome to Appium v1.8.1[info] [HTTP] --> POST /wd/hub/session
[info] [HTTP] {"capabilities":{"firstMatch":[{}],"alwaysMatch":{"platformName":"Android","appium:platformVersion":"5.1.1","appium:deviceName":"127.0.0.1:21503","appium:app":"C:\\pyln\\dr.fone3.2.0.apk","appium:appPackage":"com.wondershare.drfone","appium:appActivity":"com.wondershare.drfone.ui.activity.WelcomeActivity"}},"desiredCapabilities":{"platformName":"Android","platformVersion":"5.1.1","deviceName":"127.0.0.1:21503","app":"C:\\pyln\\dr.fone3.2.0.apk","appPackage":"com.wondershare.drfone","appActivity":"com.wondershare.drfone.ui.activity.WelcomeActivity"}}
[debug] [MJSONWP] Calling AppiumDriver.createSession() with args: [{"platformName":"Android","platformVersion":"5.1.1","deviceName":"127.0.0.1:21503","app":"C:\\pyln\\dr.fone3.2.0.apk","appPackage":"com.wondershare.drfone","appActivity":"com.wondershare.drfone.ui.activity.WelcomeActivity"},null,{"firstMatch":[{}],"alwaysMatch":{"platformName":"Android","appium:platformVersion":"5.1.1","appium:deviceName":"127.0.0.1:21503","appium:app":"C:\\pyln\\dr.fone3.2.0.apk","appium:appPackage":"com.wondershare.drfone","appium:appActivity":"com.wondershare.drfone.ui.activity.WelcomeActivity"}}]
[debug] [BaseDriver] Event 'newSessionRequested' logged at 1537943514254 (14:31:54 GMT+0800 (中国标准时间))
[info] [Appium] Creating new AndroidDriver (v2.7.0) session
[info] [Appium] Capabilities:
[info] [Appium]   platformName: Android
[info] [Appium]   platformVersion: 5.1.1
[info] [Appium]   deviceName: 127.0.0.1:21503
[info] [Appium]   app: C:\pyln\dr.fone3.2.0.apk
[info] [Appium]   appPackage: com.wondershare.drfone
[info] [Appium]   appActivity: com.wondershare.drfone.ui.activity.WelcomeActivity
[debug] [BaseDriver] W3C capabilities {"alwaysMatch":{"platformNa... and MJSONWP desired capabilities [object Object] were provided
[debug] [BaseDriver] Creating session with W3C capabilities: {"alwaysMatch":{"platformNa...
[info] [BaseDriver] Session created with session id: 2955de37-5ae9-4a6c-b31f-32b768bddc58
[debug] [AndroidDriver] Getting Java version[info] [AndroidDriver] Java version is: 1.8.0_161
[info] [ADB] Checking whether adb is present
[info] [ADB] Found 26 'build-tools' folders under 'D:\Andriod_SDK' (newest first):
[info] [ADB]     D:/Andriod_SDK/build-tools/28.0.2
[info] [ADB]     D:/Andriod_SDK/build-tools/28.0.1
[info] [ADB]     D:/Andriod_SDK/build-tools/28.0.0
[info] [ADB]     D:/Andriod_SDK/build-tools/27.0.3
[info] [ADB]     D:/Andriod_SDK/build-tools/27.0.2
[info] [ADB]     D:/Andriod_SDK/build-tools/27.0.1
[info] [ADB]     D:/Andriod_SDK/build-tools/27.0.0
[info] [ADB]     D:/Andriod_SDK/build-tools/26.0.3
[info] [ADB]     D:/Andriod_SDK/build-tools/26.0.2
[info] [ADB]     D:/Andriod_SDK/build-tools/26.0.1
[info] [ADB]     D:/Andriod_SDK/build-tools/26.0.0
[info] [ADB]     D:/Andriod_SDK/build-tools/25.0.3
[info] [ADB]     D:/Andriod_SDK/build-tools/25.0.2
[info] [ADB]     D:/Andriod_SDK/build-tools/25.0.1
[info] [ADB]     D:/Andriod_SDK/build-tools/25.0.0
[info] [ADB]     D:/Andriod_SDK/build-tools/24.0.3
[info] [ADB]     D:/Andriod_SDK/build-tools/24.0.2
[info] [ADB]     D:/Andriod_SDK/build-tools/24.0.1
[info] [ADB]     D:/Andriod_SDK/build-tools/24.0.0
[info] [ADB]     D:/Andriod_SDK/build-tools/23.0.3
[info] [ADB]     D:/Andriod_SDK/build-tools/23.0.2
[info] [ADB]     D:/Andriod_SDK/build-tools/23.0.1
[info] [ADB]     D:/Andriod_SDK/build-tools/22.0.1
[info] [ADB]     D:/Andriod_SDK/build-tools/21.1.2
[info] [ADB]     D:/Andriod_SDK/build-tools/20.0.0
[info] [ADB]     D:/Andriod_SDK/build-tools/19.1.0
[info] [ADB] Using adb.exe from D:\Andriod_SDK\platform-tools\adb.exe
[info] [AndroidDriver] Retrieving device list
[debug] [ADB] Trying to find a connected android device
[debug] [ADB] Getting connected devices...[debug] [ADB] 1 device(s) connected
[info] [AndroidDriver] Looking for a device with Android '5.1.1'
[debug] [ADB] Setting device id to 127.0.0.1:21503
[info] [ADB] Getting device platform version
[debug] [ADB] Running 'D:\Andriod_SDK\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:21503 shell getprop ro.build.version.release'[debug] [ADB] Current device property 'ro.build.version.release': 5.1.1
[info] [AndroidDriver] Using device: 127.0.0.1:21503
[debug] [ADB] Setting device id to 127.0.0.1:21503
[info] [BaseDriver] Using local app 'C:\pyln\dr.fone3.2.0.apk'
[debug] [AndroidDriver] Checking whether app is actually present
[info] [AndroidDriver] Starting Android session
[debug] [ADB] Running 'D:\Andriod_SDK\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:21503 wait-for-device'
[debug] [ADB] Running 'D:\Andriod_SDK\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:21503 shell echo ping'[debug] [AndroidDriver] Pushing settings apk to device...
[debug] [ADB] Getting install status for io.appium.settings
[debug] [ADB] Running 'D:\Andriod_SDK\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:21503 shell pm list packages io.appium.settings'[debug] [ADB] App is not installed
[debug] [ADB] App 'C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\io.appium.settings\app\build\outputs\apk\settings_apk-debug.apk' not installed. Installing
[debug] [ADB] Running 'D:\Andriod_SDK\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:21503 shell getprop ro.build.version.sdk'[debug] [ADB] Current device property 'ro.build.version.sdk': 22
[debug] [ADB] Device API level: 22
[debug] [ADB] Skipping granting permissions for 'C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\io.appium.settings\app\build\outputs\apk\settings_apk-debug.apk', since the current API level 22 does not support applications permissions customization
[debug] [ADB] Running 'D:\Andriod_SDK\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:21503 install 'C:\\Program Files\\Appium\\resources\\app\\node_modules\\appium\\node_modules\\io.appium.settings\\app\\build\\outputs\\apk\\settings_apk-debug.apk''[debug] [ADB] Install command stdout: [100%] /data/local/tmp/settings_apk-debug.apk
[debug] [ADB] C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\io.appium.settings\app\build\outputs\apk\settings_apk-debug.apk: 1 file pushed. 0.1 MB/s (45149 bytes in 0.414s)
[debug] [ADB]     pkg: /data/local/tmp/settings_apk-debug.apk

[debug] [ADB] Success
[debug] [ADB] Running 'D:\Andriod_SDK\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:21503 shell ps'[debug] [ADB] Device API level: 22
[debug] [ADB] Running 'D:\Andriod_SDK\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:21503 shell am start -W -n io.appium.settings/.Settings -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000'[debug] [ADB] Device API level: 22
[debug] [ADB] Running 'D:\Andriod_SDK\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:21503 shell settings put secure mock_location 1'[warn] [AndroidDriver] setDeviceLanguageCountry requires language or country.
[warn] [AndroidDriver] Got language: 'undefined' and country: 'undefined'
[debug] [Logcat] Starting logcat capture[debug] [AndroidDriver] Pushing unlock helper app to device...
[debug] [ADB] Getting install status for io.appium.unlock
[debug] [ADB] Running 'D:\Andriod_SDK\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:21503 shell pm list packages io.appium.unlock'[debug] [ADB] App is not installed
[debug] [ADB] App 'C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\appium-unlock\bin\unlock_apk-debug.apk' not installed. Installing
[debug] [ADB] Device API level: 22
[debug] [ADB] Skipping granting permissions for 'C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\appium-unlock\bin\unlock_apk-debug.apk', since the current API level 22 does not support applications permissions customization
[debug] [ADB] Running 'D:\Andriod_SDK\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:21503 install 'C:\\Program Files\\Appium\\resources\\app\\node_modules\\appium\\node_modules\\appium-unlock\\bin\\unlock_apk-debug.apk''[debug] [ADB] Install command stdout: [100%] /data/local/tmp/unlock_apk-debug.apk
[debug] [ADB] C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\appium-unlock\bin\unlock_apk-debug.apk: 1 file pushed. 0.1 MB/s (34611 bytes in 0.293s)
[debug] [ADB]     pkg: /data/local/tmp/unlock_apk-debug.apk

[debug] [ADB] Success
[info] [ADB] Getting device platform version
[debug] [ADB] Running 'D:\Andriod_SDK\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:21503 shell getprop ro.build.version.release'[debug] [ADB] Current device property 'ro.build.version.release': 5.1.1
[debug] [ADB] Running 'D:\Andriod_SDK\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:21503 shell wm size'[debug] [ADB] Running 'D:\Andriod_SDK\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:21503 shell getprop ro.product.model'[debug] [ADB] Current device property 'ro.product.model': SM-G9350
[debug] [ADB] Running 'D:\Andriod_SDK\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:21503 shell getprop ro.product.manufacturer'[debug] [ADB] Current device property 'ro.product.manufacturer': samsung
[debug] [ADB] Getting install status for com.wondershare.drfone
[debug] [ADB] Running 'D:\Andriod_SDK\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:21503 shell pm list packages com.wondershare.drfone'[debug] [ADB] App is installed
[debug] [ADB] Getting install status for com.wondershare.drfone
[debug] [ADB] Running 'D:\Andriod_SDK\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:21503 shell pm list packages com.wondershare.drfone'[debug] [ADB] App is installed
[debug] [ADB] Getting package info for 'com.wondershare.drfone'
[debug] [ADB] Running 'D:\Andriod_SDK\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:21503 shell dumpsys package com.wondershare.drfone'[info] [ADB] Checking whether aapt is present
[info] [ADB] Using aapt.exe from D:\Andriod_SDK\build-tools\28.0.2\aapt.exe[debug] [ADB] The installed 'com.wondershare.drfone' package does not require upgrade ('3.2.0' >= '3.2.0')
[info] [AndroidDriver] Performing fast reset on 'com.wondershare.drfone'
[debug] [ADB] Getting install status for com.wondershare.drfone
[debug] [ADB] Running 'D:\Andriod_SDK\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:21503 shell pm list packages com.wondershare.drfone'[debug] [ADB] App is installed
[debug] [ADB] Running 'D:\Andriod_SDK\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:21503 shell am force-stop com.wondershare.drfone'[debug] [ADB] Running 'D:\Andriod_SDK\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:21503 shell pm clear com.wondershare.drfone'[debug] [AndroidDriver] Performed fast reset on the installed 'com.wondershare.drfone' application (stop and clear)
[debug] [ADB] Running 'D:\Andriod_SDK\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:21503 shell rm -rf /data/local/tmp/strings.json'[debug] [AndroidDriver] Extracting strings from apk
[debug] [AndroidDriver] C:\pyln\dr.fone3.2.0.apk
[debug] [AndroidDriver] undefined
[debug] [AndroidDriver] C:\Users\ADMINI~1\AppData\Local\Temp\com.wondershare.drfone
[debug] [ADB] Extracting strings for language: default[info] [ADB] Successfully extracted 418 strings from 'C:\pyln\dr.fone3.2.0.apk' resources for '(default)' configuration[debug] [ADB] Running 'D:\Andriod_SDK\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:21503 push C\:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\com.wondershare.drfone\\strings.json /data/local/tmp'[debug] [AndroidBootstrap] Watching for bootstrap disconnect
[debug] [ADB] Forwarding system: 4724 to device: 4724
[debug] [ADB] Running 'D:\Andriod_SDK\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:21503 forward tcp\:4724 tcp\:4724'
[debug] [UiAutomator] Starting UiAutomator
[debug] [UiAutomator] Moving to state 'starting'
[debug] [UiAutomator] Parsing uiautomator jar
[debug] [UiAutomator] Found jar name: 'AppiumBootstrap.jar'
[debug] [ADB] Running 'D:\Andriod_SDK\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:21503 push 'C:\\Program Files\\Appium\\resources\\app\\node_modules\\appium\\node_modules\\appium-android-bootstrap\\bootstrap\\bin\\AppiumBootstrap.jar' /data/local/tmp/'[debug] [ADB] Attempting to kill all uiautomator processes
[debug] [ADB] Getting all processes with uiautomator
[debug] [ADB] Running 'D:\Andriod_SDK\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:21503 shell ps'[info] [ADB] No uiautomator process found to kill, continuing...
[debug] [UiAutomator] Starting UIAutomator
[debug] [ADB] Creating ADB subprocess with args: ["-P",5037,"-s","127.0.0.1:21503","shell","uiautomator","runtest","AppiumBootstrap.jar","-c","io.appium.android.bootstrap.Bootstrap","-e","pkg","com.wondershare.drfone","-e","disableAndroidWatchers",false,"-e","acceptSslCerts",false][debug] [UiAutomator] Moving to state 'online'
[info] [AndroidBootstrap] Android bootstrap socket is now connected
[debug] [ADB] Running 'D:\Andriod_SDK\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:21503 shell dumpsys window'
[debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Loading json...
[debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] json loading complete.
[debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Registered crash watchers.[debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Client connected[info] [AndroidDriver] Screen already unlocked, doing nothing
[debug] [ADB] Device API level: 22
[debug] [ADB] Running 'D:\Andriod_SDK\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:21503 shell am start -W -n com.wondershare.drfone/com.wondershare.drfone.ui.activity.WelcomeActivity -S'[debug] [ADB] Running 'D:\Andriod_SDK\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:21503 shell am start -W -n com.wondershare.drfone/com.wondershare.drfone.ui.activity.WelcomeActivity -S'[debug] [AndroidDriver] Shutting down Android driver
[debug] [ADB] Running 'D:\Andriod_SDK\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:21503 shell am force-stop com.wondershare.drfone'[debug] [ADB] Pressing the HOME button
[debug] [ADB] Running 'D:\Andriod_SDK\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:21503 shell input keyevent 3'[debug] [AndroidBootstrap] Sending command to android: {"cmd":"shutdown"}[debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"shutdown"}
[debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type SHUTDOWN
[debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"status":0,"value":"OK, shutting down"}
[debug] [AndroidBootstrap] Received command result from bootstrap
[debug] [UiAutomator] Shutting down UiAutomator
[debug] [UiAutomator] Moving to state 'stopping'
[debug] [UiAutomator] UiAutomator shut down normally
[debug] [UiAutomator] Moving to state 'stopped'
[debug] [ADB] Attempting to kill all uiautomator processes
[debug] [ADB] Getting all processes with uiautomator
[debug] [ADB] Running 'D:\Andriod_SDK\platform-tools\adb.exe -P 5037 -s 127.0.0.1\:21503 shell ps'[info] [ADB] No uiautomator process found to kill, continuing...
[debug] [UiAutomator] Moving to state 'stopped'
[debug] [Logcat] Stopping logcat capture[debug] [AndroidDriver] Not cleaning generated files. Add `clearSystemFiles` capability if wanted.
[debug] [BaseDriver] Event 'newSessionStarted' logged at 1537943630645 (14:33:50 GMT+0800 (中国标准时间))
[error] [W3C] Encountered internal error running command: Error: Cannot start the 'com.wondershare.drfone' application. Original error: Error executing adbExec. Original error: 'Command 'D\:\\Andriod_SDK\\platform-tools\\adb.exe -P 5037 -s 127.0.0.1\:21503 shell am start -W -n com.wondershare.drfone/com.wondershare.drfone.ui.activity.WelcomeActivity -S' timed out after 20000ms'; Stderr: ''; Code: 'null'
[error] [W3C]     at ADB.callee$0$0$ (C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\appium-adb\lib\tools\apk-utils.js:125:11)
[error] [W3C]     at tryCatch (C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:67:40)
[error] [W3C]     at GeneratorFunctionPrototype.invoke [as _invoke] (C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:315:22)
[error] [W3C]     at GeneratorFunctionPrototype.prototype.(anonymous function) [as throw] (C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:100:21)
[error] [W3C]     at GeneratorFunctionPrototype.invoke (C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:136:37)
[error] [W3C]     at <anonymous>
[info] [HTTP] <-- POST /wd/hub/session 500 116610 ms - 1982
[info] [HTTP] 
帅强测试开发之路的主页 帅强测试开发之路 | 菜鸟二级 | 园豆:206
提问于:2018-09-26 14:57
< >
分享
最佳答案
0

Cannot start the 'com.wondershare.drfone' application
应用都没有跑起来

奖励园豆:5
ycyzharry | 高人七级 |园豆:24896 | 2018-09-27 10:13
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册