selenium remotewebdriver with python - performance logging? selenium remotewebdriver with python - performance logging? selenium selenium

selenium remotewebdriver with python - performance logging?


In case anyone is wondering, this seems to do the trick for me:

(Assuming you're using selenium remote)

url = 'http://remote instance IP:PORT/wd/hub'descaps = {'browserName': 'chrome', 'loggingPrefs': {'performance': 'INFO'}}driver = webdriver.Remote(command_executor=url, desired_capabilities=descaps)driver.command_executor._commands.update({'getAvailableLogTypes':                         ('GET', '/session/sessionId/log/types'),                         {'getLog': ('POST', '/session/$sessionId/log')})getlog = driver.execute('getLog', {'type': 'performance'})['value']

(Of the two added commands 'getAvailableLogTypes' and 'getLog' - you only see the former in the above code snippet. The latter simply returns a list of the available log types on your remote session.)

Now all I need to do is interpret it ....


After playing around with the Chromedriver log for a while, I found a more compact solution that works on browsers other than Chrome.

This: https://pypi.python.org/pypi/seleniumwrapper

Which adds a nice wrapper round the Navigation Timing API (https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/NavigationTiming/Overview.html). Gives a far more compact set of data and is much easier to interpret and use.

The other wrappers it puts round standard Selenium are actually quite nice too!