appium - Appium - 超时并且从未得到命令的响应
问题描述
我们让 Jenkins 使用 Appium 启动 UI 测试,但结果是一个错误:
remote stacktrace: UnknownError: An unknown server-side error occurred while processing the command. Original error: Error getting AVD with retry. Original error: Condition unmet after 60063 ms. Timing out.
emulator
而且Appium的任务运行时也没有找到进程。Appium的输出还说:
[debug] [ADB] Emulator Nexus_5X_API_26 not running [debug] [ADB] Trying to find Nexus_5X_API_26 emulator [debug] [ADB] Getting connected emulators [debug] [ADB] Getting connected devices... [debug] [ADB] 0 device(s) connected [debug] [ADB] 0 emulator(s) connected
好的,我看到该设备没有启动,这是“超时”错误的原因。
但是为什么Appium不能启动呢?
我能够获得emulator
可执行文件,并且启动 Appium 任务的 Jenkins 的工作可以看到设备:
[Pipeline] sh + avdmanager list avd ... Name: Nexus_5X_API_26 Device: Nexus 5X (Google) Path: /home/user/.android/avd/Nexus_5X_API_26.avd Target: Google Play (Google Inc.) Based on: Android 8.0 (Oreo) Tag/ABI: google_apis_playstore/x86 Skin: 1080x1920 Sdcard: 100 MB --------- Name: test Path: /home/user/.android/avd/test.avd Target: Google APIs (Google Inc.) Based on: Android 7.1.1 (Nougat) Tag/ABI: google_apis/x86 [Pipeline] sh + emulator -list-avds Nexus_5X_API_26 test
如果我只是通过运行手动启动设备:
/android/Android/sdk/emulator/emulator -avd Nexus_5X_API_26
并在此之后触发 Jenkins 的工作 - 我还有另一个错误:
... [ADB] Using adb from /android/Android/sdk/platform-tools/adb [debug] [ADB] Trying to find Nexus_5X_API_26 emulator [debug] [ADB] Getting connected emulators [debug] [ADB] Getting connected devices... [debug] [ADB] 1 device(s) connected [debug] [ADB] 1 emulator(s) connected [debug] [ADB] Sending telnet command to device: avd name [debug] [ADB] Getting running emulator port [debug] [ADB] Socket connection to device created [debug] [UiAutomator2] Deleting UiAutomator2 session [debug] [BaseDriver] Event 'newSessionStarted' logged at 1542807589908 (15:39:49 GMT+0200 (EET)) [debug] [W3C] Encountered internal error running command: Error: Error getting AVD. Original error: Never got a response from command [debug] [W3C] at ADB.callee$0$0$ (/usr/local/lib/node_modules/appium/node_modules/appium-adb/lib/tools/system-calls.js:488:11) ...
有任何想法吗?
甚至不能用“ appium Never got a response from command ”请求搜索任何东西......
此外,我无法在我的工作站笔记本电脑上重现此问题 - 一切都完美无缺。
UPD属性是:
<profile>
<id>linux-emulator-8.0</id>
<properties>
<hub.url>http://0.0.0.0:4723/wd/hub</hub.url>
<device.name>Android Emulator</device.name>
<avd>Nexus_5X_API_26</avd>
<platform.name>Android</platform.name>
<platform.version>8.0</platform.version>
<auto.grant.permissions>true</auto.grant.permissions>
<full.reset>true</full.reset>
<no.reset>false</no.reset>
<app.path>/home/user/project/project.apk</app.path>
<app.name>com.gen.workoutme</app.name>
<screenshot.path>
${project.basedir}/../screenShots/${platform.name}/${platform.version}/${device.name}/
</screenshot.path>
<automation.name>UiAutomator2</automation.name>
</properties>
</profile>
UPD 2不知道如何 - 但如果emulator
手动运行它就不行。emulator
但是,从 Appium 本身启动仍然存在问题。
在其日志中发现了奇怪的错误:
[ADB] [AVD OUTPUT] Fatal: QXcbConnection: Could not connect to display ((null):0, (null)) [ADB] [AVD OUTPUT] INFO: QtLogger.cpp:66: Fatal: QXcbConnection: Could not connect to display ((null):0, (null)) [ADB] Emulator avd Nexus_5X_API_26 exited with code null, signal SIGABRT
暂时还不能用谷歌搜索,但它看起来是主要问题——$DISPLAY
虽然它存在,但它与 .
解决方案
我能够毫无问题地在模拟器上启动和运行测试。在设置驱动程序时,我使用以下三个功能以及其他功能。
avd
: AVD 的名称avdLaunchTimeout
: 等待模拟器启动超时。avdReadyTimeout
: 等待模拟器准备好超时。
尝试使用这些功能,你应该会很好。
还要检查 Android SDK 和模拟器是否有任何更新。如果有可用的更新,最好更新它。
推荐阅读
- javascript - 回调函数 - express MDN 教程
- r - 侧边栏面板/侧边栏面板中的 R Shiny Collapsible Boxes 带有多个全尺寸的可折叠框
- mpandroidchart - MPAndroidChart LineChart:在靠近中心的线上偏移圆
- javascript - 我无法在 javascript 中访问数组内的对象
- apache - htaccess 重写以反转子文件夹
- flutter - 在 Flutter / Dart 中合并 2 个不可变变量
- excel - 如果以编程方式触发关闭,为什么 VBA Workbook.Close 语句在 Workbook_BeforeClose 内失败?
- python - Pandas:从互斥选择的多列中获取一行中特定单个值的列索引/标签
- sql - 为什么 SELECT 命令在过程的开头而不是结尾?
- python - 检查 TCP 数据包:Ryu - Python