How to reset browser cache in the middle of a script?

I have a script where I measure what I want with logData 0 before it and logData 1 preceding my navigate stuff.

However I also want to clear the browser cache before my navigate step to display the effect of browser cache. How do I do that?

If it helps, the context here is that I am trying to match WebPageTest results with that of the URL benchmarked using the Chrome Extension PageBenchmarker:

As you can see it has the option of “Clear Cache” and Connections. When set they do not use the browser cache as well as not reuse existing sockets to that origin. In such a case the content is 900KB downloaded whereas with webpagetest I see only 50Kb downloaded due to the browser cache apart from reusing the connection.

So in order for me to replicate the same results using my Private Agent, I am looking for a way to trigger “WebBrowser::ClearUserData()” from the script.

Can you not just navigate directly to the page you are trying to test? If it’s behind authentication you can just set the cookies for an existing session.

You may be able to use a “clearCache” command if you are using Chrome but I can’t guarantee that it will behave exactly the same because it also clears out cookies (which may defeat what you are trying to do).