2016-02-04 41 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好得多。

相關問題