use of org.openqa.selenium.logging.LogEntry in project cerberus-source by cerberustesting.
the class WebDriverService method getSeleniumLog.
@Override
public List<String> getSeleniumLog(Session session) {
List<String> result = new ArrayList();
Logs logs = session.getDriver().manage().logs();
for (String logType : logs.getAvailableLogTypes()) {
LogEntries logEntries = logs.get(logType);
result.add("********************" + logType + "********************\n");
for (LogEntry logEntry : logEntries) {
result.add(new Date(logEntry.getTimestamp()) + " : " + logEntry.getLevel() + " : " + logEntry.getMessage() + "\n");
}
}
return result;
}
use of org.openqa.selenium.logging.LogEntry in project blueocean-plugin by jenkinsci.
the class ATHJUnitRunner method outputConsoleLogs.
private void outputConsoleLogs() {
WebDriver driver = injector.getInstance(WebDriver.class);
List<LogEntry> allEntries = driver.manage().logs().get("browser").getAll();
LogEntryLogger.recordLogEntries(allEntries);
}
use of org.openqa.selenium.logging.LogEntry in project flow by vaadin.
the class EmptyListsIT method emptyListsAreProperlyHandled.
@Test
public void emptyListsAreProperlyHandled() {
open();
TestBenchElement template = $("*").id("template");
Assert.assertTrue(template.$("*").attributeContains("class", "item").exists());
findElement(By.id("set-empty")).click();
LogEntries logs = driver.manage().logs().get("browser");
if (logs != null) {
Optional<LogEntry> anyError = StreamSupport.stream(logs.spliterator(), true).filter(entry -> entry.getLevel().intValue() > java.util.logging.Level.INFO.intValue()).filter(entry -> !entry.getMessage().contains("favicon.ico")).filter(entry -> !entry.getMessage().contains("HTML Imports is deprecated")).filter(entry -> !entry.getMessage().contains("sockjs-node")).filter(entry -> !entry.getMessage().contains("[WDS] Disconnected!")).filter(entry -> !entry.getMessage().contains("WebSocket connection to 'ws://")).findAny();
anyError.ifPresent(entry -> Assert.fail(entry.getMessage()));
}
}
use of org.openqa.selenium.logging.LogEntry in project chrome_page_performance_sqlite_java by sergueik.
the class ChromePagePerformanceUtilTest method afterMethod.
@After
public void afterMethod() {
System.err.println("After Method:");
int cnt = 0;
int maxCnt = 5;
LogEntries logEntries = driver.manage().logs().get(LogType.PERFORMANCE);
for (LogEntry logEntry : logEntries) {
if (cnt++ > maxCnt) {
break;
}
// System.err.println("Log entry: " + logEntry.getMessage());
System.err.println(String.format("Log entry %d: ", cnt));
Map<String, Object> o = (Map<String, Object>) logEntry.toJson();
JSONObject logEntryJSONObject = new JSONObject(o.get("message"));
Iterator<String> logEntryKeys = logEntryJSONObject.keys();
while (logEntryKeys.hasNext()) {
String logEntryKey = logEntryKeys.next();
System.err.println(logEntryKey);
}
}
}
use of org.openqa.selenium.logging.LogEntry in project scout.rt by eclipse.
the class BrowserLogRule method finished.
@Override
protected void finished(Description description) {
Date end = new Date();
long duration = end.getTime() - m_start.getTime();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
LogEntries logEntries = m_driver.manage().logs().get(LogType.BROWSER);
for (LogEntry logEntry : logEntries) {
System.out.println(sdf.format(new Date(logEntry.getTimestamp())) + " " + logEntry.getLevel() + " " + logEntry.getMessage());
}
System.out.println(MessageFormat.format("^ | {1}.{2} [{0}] (took {3} ms)", sdf.format(end), description.getClassName(), description.getMethodName(), duration));
}
Aggregations