Alpha
Alpha

Reputation: 14046

Unable to get performance logs

I'm trying to get performance logs using Selenium WebDriver with following code:

DesiredCapabilities cap = DesiredCapabilities.firefox();
LoggingPreferences logPrefs = new LoggingPreferences();
logPrefs.enable(LogType.PERFORMANCE, Level.ALL);
cap.setCapability(CapabilityType.LOGGING_PREFS, logPrefs);

WebDriver driver = new FirefoxDriver(cap);

driver.get("http://www.google.com");

System.out.println("Performance: " + driver.manage().logs().get(LogType.PERFORMANCE).getAll());

for (LogEntry entry : driver.manage().logs().get(LogType.PERFORMANCE)) {
    System.out.println("Entry: " + entry.toString());
}

driver.quit();

After running above code, I didn't get anything in return as logs. If you see output of line:

System.out.println("Performance: " + driver.manage().logs().get(LogType.PERFORMANCE).getAll());

it's returning empty array. Can you please suggest what I'm doing wrong here?

Upvotes: 1

Views: 2538

Answers (1)

alecxe
alecxe

Reputation: 473873

As far as I understand, performance logs are not available for Firefox WebDriver at the moment.

You can switch to ChromeDriver to make it work, this is what I'm sure is working:

Upvotes: 1

Related Questions