运行测试套件(有20-30个测试用例)在运行6-7测试用例后崩溃的仿真器时间应用程序崩溃,它在我们在物理设备上执行时工作。但我们必须使用模拟器,我们使用的是Android Emulator和Genymotion。
@lav Sharma,请你在这里扩展一下:
WebView.setWebContentsDebuggingEnabled(true);
或关闭WebView.setWebContentsDebuggingEnabled(false);
在app的onCreate方法中;
List<LogEntry> logs = driver.manage().logs().get("logcat").getAll();
public static void dumpLogs(AppiumDriver driver, String testName)
{
String logPath = "C:\\automation_capture\\";
log.info("{}: Saving device log...", driver.getSessionId());
List<LogEntry> logEntries = driver.manage().logs().get("logcat").filter(Level.ALL);
File logFile = new File(String.format("%s_%s.txt",logPath,testName));
PrintWriter log_file_writer = new PrintWriter(logFile);
log_file_writer.println(logEntries );
log_file_writer.flush();
log.info("{}: Saving device log - Done.",driver.getSessionId());
}
}
希望这可以帮助。最好的问候,尤金