【发布时间】:2018-08-02 06:22:40
【问题描述】:
遇到一个问题,以前工作的基于 appium 的 Android 应用 selenium 测试突然停止工作(一直成功)。
这个问题与 appium 启动应用程序有关(应用程序总是在使用物理用户输入打开时启动......)。基本上应用程序启动,加载屏幕出现,然后崩溃。大多数情况下都会发生这种情况,但并非总是如此。我发现它通常在重新启动手机后最初可以正常工作。但是,它会在后续运行时崩溃。
任何帮助将不胜感激。已经尝试了很多东西/在网上搜索,但都无济于事..
这是 appium 的输出:
[AndroidDriver] Parsed pid: '27608' pkg: 'com.dedsert.betbright.uat' from
[AndroidDriver] USER PID PPID VSIZE RSS WCHAN PC NAME
[AndroidDriver] u0_a236 27608 4736 3621124 393160 0 0000000000 R com.dedsert.betbright.uat
[AndroidDriver] Returning process name: 'com.dedsert.betbright.uat'
[AndroidDriver] Found webviews: ["WEBVIEW_com.dedsert.betbright.uat"]
[AndroidDriver] Available contexts: ["NATIVE_APP","WEBVIEW_com.dedsert.betbright.uat"]
[MJSONWP] Responding to client with driver.setContext() result: null
[HTTP] <-- POST /wd/hub/session/a9457315-d657-4fd1-bdf0-36fe5d76b3c5/context 200 245 ms - 76
[AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_RESULT: shortMsg=java.lang.StackOverflowError
[AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_RESULT: longMsg=stack size 1037KB
[AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_CODE: 0
[UiAutomator] UiAutomator exited unexpectedly with code 4294967295, signal null
[UiAutomator] Moving to state 'stopped'
[AndroidDriver] Shutting down Android driver
[Appium] Closing session, cause was 'UiAUtomator shut down unexpectedly'
[Appium] Removing session a9457315-d657-4fd1-bdf0-36fe5d76b3c5 from our master session list
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Users\kroring\AppData\Local\Android\Sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","ce051715c336451002","shell","am","force-stop","com.dedsert.betbright.uat"]
[ADB] Pressing the HOME button
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Users\kroring\AppData\Local\Android\Sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","ce051715c336451002","shell","input","keyevent",3]
[AndroidBootstrap] Cannot shut down Android bootstrap; it has already shut down
[Logcat] Stopping logcat capture
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\Users\kroring\AppData\Local\Android\Sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","ce051715c336451002","shell","am","force-stop","io.appium.unlock"]
[AndroidDriver] Not cleaning generated files. Add `clearSystemFiles` capability if wanted.
[HTTP] --> POST /wd/hub/session/a9457315-d657-4fd1-bdf0-36fe5d76b3c5/context {"name":"WEBVIEW_com.dedsert.betbright.uat"}
[HTTP] <-- POST /wd/hub/session/a9457315-d657-4fd1-bdf0-36fe5d76b3c5/context 404 1 ms - 131
在 IntelliJ 方面看不到很多东西 - 确实在给定的堆栈跟踪中发现了这一点:
org.openqa.selenium.remote.SessionNotFoundException: A session is either terminated or not started (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 5 milliseconds
【问题讨论】:
-
shortMsg=java.lang.StackOverflowError看起来某个进程内存不足。这可能表明其中一个程序存在内存泄漏,但由于您的设置信息和知识有限,很难判断。手机上是否有很多应用/通知/服务/后台进程在运行?
标签: java android selenium appium