Package org.openqa.selenium.logging

Examples of org.openqa.selenium.logging.LogEntries


    // Try to capture logs
    try {
      Logs logs = driver.manage().logs();
      if (logs != null) {
        if (logs.getAvailableLogTypes().contains(LogType.BROWSER)) {
          LogEntries entries = logs.get(LogType.BROWSER);
          if (entries != null) {
            StringBuilder sb = new StringBuilder();
            for (LogEntry e : entries) {
              sb.append(e.toString() + "\n");
            }
View Full Code Here


  @Test
  public void testPageLoadShouldProducePerformanceLogEntries() throws Exception {
    createDriver(Level.INFO);
    driver.get(pages.simpleTestPage);
    LogEntries entries = driver.manage().logs().get(LogType.PERFORMANCE);
    assertTrue(Iterables.size(entries) > 0, "Performance log contains entries.");
  }
View Full Code Here

  @Test
  public void testLogBufferShouldBeResetAfterEachGetLogCall() {
    Set<String> logTypes = driver.manage().logs().getAvailableLogTypes();
    for (String logType : logTypes) {
      driver.get(pages.simpleTestPage);
      LogEntries firstEntries = driver.manage().logs().get(logType);
      if (!firstEntries.getAll().isEmpty()) {
        LogEntries secondEntries = driver.manage().logs().get(logType);
        assertFalse(LogEntriesChecks.hasOverlappingLogEntries(
                firstEntries, secondEntries),
            String.format("There should be no overlapping log entries in " +
                "consecutive get log calls for %s logs", logType));
      }
View Full Code Here

      LoggingPreferences logPrefs = new LoggingPreferences();
      logPrefs.enable(logType, Level.OFF);
      caps.setCapability(CapabilityType.LOGGING_PREFS, logPrefs);
      startDriver(caps);
      driver.get(pages.simpleTestPage);
      LogEntries entries = driver.manage().logs().get(logType);
      assertTrue(entries.getAll().isEmpty(),
          String.format("There should be no log entries for " +
              "log type %s when logging is turned off.", logType));
    }
    stopDriver();
  }
View Full Code Here

  }

  public LogEntries get(String logType) {
    Iterable<LogEntry> toReturn = getLocalLogs(logType);
    localLogs.remove(logType);
    return new LogEntries(toReturn);
  }
View Full Code Here

        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);
        }
    }
View Full Code Here

    @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);
        }
    }
View Full Code Here

TOP

Related Classes of org.openqa.selenium.logging.LogEntries

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.