想测试 app 在后台可以继续下载的功能,用了 driver.runAppInBackground(5) 以后 app 可以被置于后台,但是恢复到前台以后过了几秒就报错了。
另外 runAppInBackground(sec) 这个指令好想已经被弃用了。不知道各位大神有没有其他什么替代的方法?

[ADB] Error: com.sec.android.app.launcher/com.sec.android.app.launcher.activities.LauncherActivity never started
at Object.wrappedLogger.errorAndThrow (../../lib/logging.js:63:13)
at ADB.callee$0$0$ (../../../lib/tools/apk-utils.js:147:7)
at tryCatch (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
at GeneratorFunctionPrototype.invoke as _invoke
at GeneratorFunctionPrototype.prototype.(anonymous function) as next
at GeneratorFunctionPrototype.invoke (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
Error: com.sec.android.app.launcher/com.sec.android.app.launcher.activities.LauncherActivity never started
at Object.wrappedLogger.errorAndThrow (../../lib/logging.js:63:13)
at ADB.callee$0$0$ (../../../lib/tools/apk-utils.js:147:7)
at tryCatch (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
at GeneratorFunctionPrototype.invoke as _invoke
at GeneratorFunctionPrototype.prototype.(anonymous function) as next
at GeneratorFunctionPrototype.invoke (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
[ADB] Error: Error occured while starting App. Original error: com.sec.android.app.launcher/com.sec.android.app.launcher.activities.LauncherActivity never started
at Object.wrappedLogger.errorAndThrow (../../lib/logging.js:63:13)
at ADB.callee$0$0$ (../../../lib/tools/apk-utils.js:77:9)
at tryCatch (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
at GeneratorFunctionPrototype.invoke as _invoke
at GeneratorFunctionPrototype.prototype.(anonymous function) as throw
at GeneratorFunctionPrototype.invoke (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
Error: Error occured while starting App. Original error: com.sec.android.app.launcher/com.sec.android.app.launcher.activities.LauncherActivity never started
at Object.wrappedLogger.errorAndThrow (../../lib/logging.js:63:13)
at ADB.callee$0$0$ (../../../lib/tools/apk-utils.js:77:9)
at tryCatch (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
at GeneratorFunctionPrototype.invoke as _invoke
at GeneratorFunctionPrototype.prototype.(anonymous function) as throw
at GeneratorFunctionPrototype.invoke (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
[MJSONWP] Encountered internal error running command: Error: Error occured while starting App. Original error: com.sec.android.app.launcher/com.sec.android.app.launcher.activities.LauncherActivity never started
at Object.wrappedLogger.errorAndThrow (../../lib/logging.js:63:13)
at ADB.callee$0$0$ (../../../lib/tools/apk-utils.js:77:9)
at tryCatch (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
at GeneratorFunctionPrototype.invoke as _invoke
at GeneratorFunctionPrototype.prototype.(anonymous function) as throw
at GeneratorFunctionPrototype.invoke (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
[2017-08-28T15:24:12.561+0200] [INFO] com.sprylab.tools.appium.internal.DeviceRunner - Test failed, saved screenshot: ./target/screenshots/KioskTest_testAppiumIssueDownload_ad071603208f66ca40_1503926652540.png
[2017-08-28T15:24:12.561+0200] [INFO] com.sprylab.tools.appium.internal.DeviceRunner - Finished test testAppiumIssueDownload on device SM_G930F {ad071603208f66ca40}

org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: Error occured while starting App. Original error: com.sec.android.app.launcher/com.sec.android.app.launcher.activities.LauncherActivity never started (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 27.02 seconds
Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
System info: host: 'MBP-xxx.local', ip: '2001:1438:4010:2812:0:0:0:ff96', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.12.6', java.version: '1.8.0_91'
Driver info: io.appium.java_client.android.AndroidDriver
Capabilities [{appPackage=com.xxx.appiumtestapp, deviceScreenSize=1440x2560, networkConnectionEnabled=true, noReset=true, warnings={}, databaseEnabled=false, deviceName=ad071603208f66ca40, fullReset=false, platform=LINUX, deviceUDID=ad071603208f66ca40, appActivity=com.xxxx.xxxx.android.app.xxxx.splash.SplashActivity, desired={appPackage=com.sprylab.appiumtestapp, appActivity=com.sprylab.purple.android.app.purple.splash.SplashActivity, noReset=true, newCommandTimeout=300, udid=ad071603208f66ca40, platformName=Android, deviceName=SM_G930F, fullReset=false}, newCommandTimeout=300, platformVersion=7.0, webStorageEnabled=false, locationContextEnabled=false, takesScreenshot=true, javascriptEnabled=true, deviceModel=SM-G930F, udid=ad071603208f66ca40, platformName=Android, deviceManufacturer=samsung}]
Session ID: 6d10f939-a725-4f62-a562-462d89501aaf


↙↙↙阅读原文可查看相关链接,并与作者交流