Skip to content
nataliakoval edited this page Feb 12, 2015 · 9 revisions

QtWebdriver supports the browser and driver log types as defined here: https://code.google.com/p/selenium/wiki/JsonWireProtocol#Log_Type.

  • driver: captures the WebDriver logs.
  • performance: capture the Performance logs. Disabled by default.
  • browser: captures output of the javascript console.
    For the browser log type, the log levels are mapped to Javascript console methods as follows:
Log Level Javascript Console
INFO console.log
WARNING console.warn
SEVERE console.error

Logs can be activated like this:

Java

DesiredCapabilities capability = DesiredCapabilities.qtwebkit();
LoggingPreferences logs = new LoggingPreferences();
Level level = Level.ALL;
logs.enable(LogType.DRIVER, level);
logs.enable(LogType.BROWSER, level);
logs.enable(LogType.PERFORMANCE, level);
capability.setCapability(CapabilityType.LOGGING_PREFS, logs);
driver = new RemoteWebDriver(new URL(hubURL), capability);

You can get performance log entries as below. See the WebDriver logging documentation for more information.

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

Python

CAPS = {
"browserName": "qtwebkit",
        "version": "",
        "platform": "ANY",
        "javascriptEnabled": True,
        "loggingPref": {
            "driver":"ALL",
            /* etc...*/
            }
        }
self.selenium = webdriver.Chrome(desired_capabilities=CAPS)
Clone this wiki locally