use of org.openqa.selenium.logging.LogEntries in project flow by vaadin.
the class WebComponentsIT method testPolyfillLoaded.
@Test
public void testPolyfillLoaded() {
open();
Assert.assertTrue(driver.findElements(By.tagName("script")).stream().anyMatch(element -> element.getAttribute("src").endsWith("webcomponents-loader.js")));
LogEntries logs = driver.manage().logs().get("browser");
if (logs != null) {
Optional<LogEntry> anyError = StreamSupport.stream(logs.spliterator(), true).filter(entry -> entry.getLevel().intValue() > Level.INFO.intValue()).filter(entry -> !entry.getMessage().contains("favicon.ico")).findAny();
anyError.ifPresent(entry -> Assert.fail(entry.getMessage()));
}
}
use of org.openqa.selenium.logging.LogEntries in project flow by vaadin.
the class EmptyListsIT method emptyListsAreProperlyHandled.
@Test
public void emptyListsAreProperlyHandled() {
open();
WebElement template = findElement(By.id("template"));
Assert.assertTrue(isPresentInShadowRoot(template, By.className("item")));
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() > Level.INFO.intValue()).filter(entry -> !entry.getMessage().contains("favicon.ico")).findAny();
anyError.ifPresent(entry -> Assert.fail(entry.getMessage()));
}
}
use of org.openqa.selenium.logging.LogEntries in project elastest-torm by elastest.
the class EtmBaseTest method teardown.
@AfterEach
void teardown() throws IOException {
if (driver != null) {
log.info("Browser console at the end of the test");
LogEntries logEntries = driver.manage().logs().get(BROWSER);
logEntries.forEach((entry) -> log.info("[{}] {} {}", new Date(entry.getTimestamp()), entry.getLevel(), entry.getMessage()));
}
}
use of org.openqa.selenium.logging.LogEntries 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.LogEntries 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);
}
}
}
Aggregations