List of usage examples for org.openqa.selenium.logging LogEntries getAll
public List<LogEntry> getAll()
From source file:com.redskyit.scriptDriver.RunTests.java
License:MIT License
private void dumpLog() throws Exception { Logs log = driver.manage().logs();//from ww w. jav a 2s . co m LogEntries entries = log.get(LogType.BROWSER); // System.out.println(entries); List<LogEntry> list = entries.getAll(); boolean fail = false; for (int i = 0; i < list.size(); i++) { LogEntry e = list.get(i); System.out.println(e); if (e.getLevel().getName().equals("SEVERE") && e.getMessage().indexOf("Uncaught ") != -1 && e.getMessage().indexOf(" Error:") != -1) { System.out.println("*** Uncaught Error ***"); fail = true; } } if (fail) throw new Exception("Unhandled Exception! Check console log for details"); }
From source file:com.testmax.util.JavaScriptUtl.java
License:CDDL license
public void afterMethod() { if (driver != null) { LogEntries logEntries = driver.manage().logs().get(LogType.BROWSER); for (LogEntry eachEntry : logEntries.getAll()) { System.out.println(eachEntry.toString()); }/*w w w . ja va2 s .c o m*/ } }