【问题标题】:Appium - How to read log from iOS device using javaAppium - 如何使用 java 从 iOS 设备读取日志
【发布时间】:2016-05-14 19:26:12
【问题描述】:

我正在尝试使用 appium 和 java 自动化 iOS 应用程序测试。我能够在 /Users/xyz/Library/Logs/CoreSimulator/158d9eddabcdefyt586a334136/system.log 读取为模拟器生成的日志文件

当我在真机上运行测试时,我在哪里可以找到日志?我认为目前唯一的方法是在 xcode 上。

有没有人遇到过这个问题并可以指导我?

【问题讨论】:

  • 虽然处于测试阶段。 driver.manage().logs() 可能会对您有所帮助。

标签: java ios webdriver appium


【解决方案1】:

这可能会有所帮助[肯定适用于 Android]:

List<LogEntry> logEntries = driver.manage().logs().get("logcat").getAll();            
for (LogEntry entry : logEntries) {
     if (entry.getMessage().contains(event)) { //
          System.out.println("Found the logs looking for.");          
       }
}

进一步挖掘我可以找到这可能对课程有所帮助:

package io.appium.java_client.service.local.flags;
public enum IOSServerFlag implements ServerArgument{
...
    /**
     * if set, the iOS system log will be written to the console<br/>
     * Default: false
     */
    SHOW_IOS_LOG("--show-ios-log"),
...
}

它也在这里:http://appium.io/slate/en/master/?ruby#server-flags

【讨论】:

    【解决方案2】:

    如果您想查看日志,则可以使用 libimobiledevice 库或柠檬罐。 Libimobiledevice 比柠檬罐好很多。

    【讨论】:

      猜你喜欢
      • 2018-08-16
      • 2019-06-18
      • 2022-01-24
      • 2020-05-02
      • 1970-01-01
      • 1970-01-01
      • 2014-11-14
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多