1

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?

alecxe
  • 462,703
  • 120
  • 1,088
  • 1,195
Alpha
  • 13,320
  • 27
  • 96
  • 163
  • Yup @alecxe is correct as per my knowledge. But u can try out [this](http://www.softwareishard.com/blog/firebug/automate-page-load-performance-testing-with-firebug-and-selenium/) site for some other way arounds... – Vivek Singh Dec 26 '14 at 18:14

1 Answers1

1

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:

Community
  • 1
  • 1
alecxe
  • 462,703
  • 120
  • 1,088
  • 1,195