-
Notifications
You must be signed in to change notification settings - Fork 209
Description
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.