【问题标题】:Appium - Timing out and Never got a response from commandAppium - 超时并且从未得到命令的响应
【发布时间】:2019-04-24 03:23:21
【问题描述】:

我们有 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.

并且在Appium的任务运行时没有找到emulator进程。 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 则无法正常工作。 但是,从 Appium 本身启动 emulator 仍然存在问题。

在其日志中发现了奇怪的错误:

[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

目前还无法通过 Google 搜索,但它看起来是主要问题 - 与 $DISPLAY 有关联,尽管它存在。

【问题讨论】:

  • 你能展示你的能力吗?
  • @olyv 谢谢,添加了属性字段。
  • 是 maven 配置文件吗?
  • 您可以尝试添加avd 功能。欲了解更多信息,请查看AndroidMobileCapabilityType
  • 是的。你的意思是不同的吗?

标签: appium appium-android


【解决方案1】:

我可以毫无问题地在模拟器上启动和运行测试。在设置驱动程序时,我使用以下三个功能以及其他功能。

  1. avd: AVD 名称
  2. avdLaunchTimeout:等待模拟器启动超时。
  3. avdReadyTimeout: 等待模拟器准备好超时。

尝试使用这些功能,您应该会很好。

还要检查 Android SDK 和模拟器是否有任何更新。如果有可用的更新,最好更新它。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-09-06
    • 2015-10-07
    • 2017-04-27
    • 1970-01-01
    • 1970-01-01
    • 2021-10-25
    • 2011-07-05
    相关资源
    最近更新 更多