use of org.openqa.selenium.logging.LogEntries 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));
}
use of org.openqa.selenium.logging.LogEntries in project ghostdriver by detro.
the class LogTest method shouldReturnLogTypeBrowser.
@Test
public void shouldReturnLogTypeBrowser() {
WebDriver d = getDriver();
d.get(server.getBaseUrl() + "/common/errors.html");
// Throw 3 errors that are logged in the Browser's console
WebElement throwErrorButton = d.findElement(By.cssSelector("input[type='button']"));
throwErrorButton.click();
throwErrorButton.click();
throwErrorButton.click();
// Retrieve and count the errors
LogEntries logEntries = d.manage().logs().get("browser");
assertEquals(3, logEntries.getAll().size());
for (LogEntry logEntry : logEntries) {
System.out.println(logEntry);
}
// Clears logs
logEntries = d.manage().logs().get("browser");
assertEquals(0, logEntries.getAll().size());
}
use of org.openqa.selenium.logging.LogEntries in project ghostdriver by detro.
the class LogTest method shouldReturnLogTypeHar.
@Test
public void shouldReturnLogTypeHar() {
WebDriver d = getDriver();
d.get(server.getBaseUrl() + "/common/iframes.html");
LogEntries logEntries = d.manage().logs().get("har");
for (LogEntry logEntry : logEntries) {
System.out.println(logEntry);
}
String firstRequestMessage = logEntries.getAll().get(0).getMessage();
String secondRequestMessage = d.manage().logs().get("har").getAll().get(0).getMessage();
assertTrue(secondRequestMessage.length() < firstRequestMessage.length());
}
Aggregations