Skip to content

Allow inspection of network resources requested by the page #710

@stsvilik

Description

@stsvilik

I was recently tasked to test for tracking calls initiated when user performs some action on the page, and to my astonishment could not find any good solution for it. I attempted to use Performance API accessible through executeScript (on the client), but that solution turned out to be flawed because

a. API is not available on all browsers and
b. Performance API is buffered and thus resets often leaving tester w/o access to historical resources data.

My proposal is to extend webdriver protocol to permit querying of historical network resources data accessed during browsing session. This would be the same data currently available when you inspect "Network" tab of Chrome (or any other browser) development tools. I know that practically all browsers have that data, so it is just a matter of making this data accessible through webdriver protocol.

The usage would look something like this:

browser.getNetworkResources("script").contains("myscript.js")

or if we want to obtain resource data

var appCss = browser.getNetworkResources("css").find("app.css");
expect(appCss.duration).to.be.atMost(200);

IMHO Network resources data would be extremely valuable not only for testing weather a certain network call was made but also to assert if requested resources performed within permitted threshold.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions