2016-02-04 91 views
2

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

我在哪里可以找到日志当我在真实设备上运行测试?我认为现在唯一的方法就是使用xcode。

有人遇到过这个问题,可以指导我吗?

+0

虽然处于测试阶段。 'driver.manage()。logs()'可能会帮助你。 – nullpointer

回答

0

这可能是有益的[肯定在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

0

如果你想查看日志,那么你可以使用libimobiledevice库或者lemonjar。 Libimobiledevice比lemonjar好得多。

相关问题