Using the developer tools and network tab in chrome you are able to view track the quantity of data transfered.
I'm trying to find a way to do this programmatically using selenium.
I have tried adding up the transferSize in the Peformance.Resource entries (as described here: how to access Network panel on google chrome developer toools with selenium?.)
performance.clearResourceTimings();
//Do Work
window.performance.getEntriesByType('resource');
However this value is not accurate
Is this possible?
My current (inaccurate) code that totals the sizeTransfer figures
IWebDriver driver;
/*Configure WebDriver*/
IJavaScriptExecutor m_jse;
m_jse = (IJavaScriptExecutor)m_driver;
object Ents = m_jse.ExecuteScript("return window.performance.getEntriesByType('resource');");
Type t = Ents.GetType();
MethodInfo mGetCount = Ents.GetType().GetMethod("get_Count");
int count = (int)mGetCount.Invoke(Ents, null);
for(int i = 0; i < count; i++)
{
MethodInfo mi = Ents.GetType().GetMethod("get_Item");
Dictionary<string, object> dict = (Dictionary<string, object>)mi.Invoke(Ents, new object[] { i });
object Value;
dict.TryGetValue("transferSize", out Value);
string sSize = Value.ToString();
size += Convert.ToDouble(sSize);
}
return size;