简体   繁体   English

Appium-如何使用Java从iOS设备读取日志

[英]Appium - How to read log from iOS device using java

I am trying to automate iOS app testing using appium and java. 我正在尝试使用appium和java自动化iOS应用测试。 I was able to read log files generated for simulators at /Users/xyz/Library/Logs/CoreSimulator/158d9eddabcdefyt586a334136/system.log 我能够在/Users/xyz/Library/Logs/CoreSimulator/158d9eddabcdefyt586a334136/system.log中读取为模拟器生成的日志文件

Where can i find the log when I am running a test on real device? 在真实设备上运行测试时,在哪里可以找到日志? I see the only way to do so is on xcode for now. 我看到目前唯一的方法是在xcode上。

Has anybody faced this issue and can guide me ? 有人面对过这个问题并且可以指导我吗?

This might be helpful[works in Android for sure] : 这可能会有所帮助[肯定可以在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.");          
       }
}

Digging in further I could find this which might be of some help in the course : 进一步挖掘,我会发现这可能对课程有帮助:

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"),
...
}

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

If you want to see the logs then you can use libimobiledevice library or lemonjar. 如果要查看日志,则可以使用libimobiledevice库或Lemonjar。 Libimobiledevice is quite better then lemonjar. Libimobiledevice比柠檬罐好得多。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM