Search code examples
protractorwebdriver-manager

Protractor - log type 'performance' not found error


webdriver-manager 12.1.5

protractor Version 5.4.2

Chrome version 75.0.3770.100

browser.manage().logs().get('performance');

This used to work fine before upgrading my webdriver-manager and protractor version.

(node:27715) UnhandledPromiseRejectionWarning: WebDriverError: invalid argument: log type 'performance' not found
 (Session info: chrome=75.0.3770.100)
 Build info: version: '3.141.59', revision: 'e82be7d358', time:    '2018-11-14T08:25:53'
System info:, os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.14.4', java.version: '1.8.0_191'
 Driver info: driver.version: unknown
at Object.checkLegacyResponse (node_modules/selenium-webdriver/lib/error.js:546:15)

If I comment the browser.manage().logs().get('performance'); and other performance related code, then the test runs fine.

webdriver-manager logs show:

Starting ChromeDriver 75.0.3770.90  on port 12268

Solution

  • I came across a potential solution on this github issue thead. Apparently recently chromedriver has started to more strictly adhere to W3C standards and this has affected how webdriver activates logs.

    We can get around this issue by setting the w3c: false flag in chromeoptions like so.

    capabilities: {
        browserName: 'chrome',
        loggingPrefs: {
            browser: 'ALL',
            driver: 'ALL',
            performance: 'ALL',
        },
        'goog:chromeOptions': {
            perfLoggingPrefs: {
                enableNetwork: true,
            },
            w3c: false,
        },
    },