use of org.openqa.selenium.logging.LogEntry 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.LogEntry 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