Skip to content

Instantly share code, notes, and snippets.

@mozbugbox
mozbugbox / webdriverRequest.md
Last active July 18, 2021 11:44
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