Skip to content

Instantly share code, notes, and snippets.

@mozbugbox
Last active July 18, 2021 11:44
Show Gist options
  • Save mozbugbox/62a50fc0fa4127954f1bb86071472db9 to your computer and use it in GitHub Desktop.
Save mozbugbox/62a50fc0fa4127954f1bb86071472db9 to your computer and use it in GitHub Desktop.
Get network request/performance data using selenium

To get the network request data using firefox, chrome or whatever selenium driver, just access the window.performance object.

def get_performance(driver):
    """Get network performance for webdriver"""
    JS_PERFORM = "return window.performance.getEntries() || {};"
    test = driver.execute_script(JS_PERFORM)
    return test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment