Selenium remotewebdriver with python protocol - performance?

I am trying to return performance information from a remote webdriver instance. I am using Selenium Python bindings.

From what I see, this is information that I can return. Think it is only available with ChromeDriver. I am currently using FireFox, but can easily switch if it receives the information I want.

However, I'm new to Python (but learning!), And the documentation around feature dictionaries (when used for performance logging) for Python seems to be a bit limited (or my google-fu is weak today).

I found the following:

DesiredCapabilities caps = DesiredCapabilities.chrome();
LoggingPreferences logPrefs = new LoggingPreferences();
logPrefs.enable("performance", Level.INFO);
caps.setCapability(CapabilityType.LOGGING_PREFS, logPrefs);
driver = new RemoteWebDriver("http://localhost:9515", caps);

Looks like he should do what I need. But this is Java. I'm not quite sure how I'm going to convert this to Python. Assuming this is possible.

Any ideas?

+4
2

, - , , , :

(, )

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']

( "getAvailableLogTypes" "getLog" - . .)

, , ....

+4

All Articles