编辑:我会留下我的另一个答案,因为我是多么愚蠢。这是我现在正在使用的。
        var resourceJson = ieDriver.ExecuteScript("var resourceTimings = window.performance.getEntriesByType(\"resource\");return JSON.stringify(resourceTimings)");
        var resourceTimings = JsonConvert.DeserializeObject<System.Collections.ObjectModel.ReadOnlyCollection<object>>(resourceJson.ToString());
我被困在同一条船上,这是我能做的最好的:
        var resNames = ieDriver.ExecuteScript("var keys = [];for(var key in window.performance.getEntriesByType(\"resource\")){keys.push(key);} return keys;");
        Dictionary<string, Dictionary<string, object>> resTimings = new Dictionary<string, Dictionary<string, object>>();
        foreach (string name in (System.Collections.ObjectModel.ReadOnlyCollection<object>)resNames)
        {
            var resource = new Dictionary<string, object>();
            var resProperties = ieDriver.ExecuteScript(string.Format("var keys = [];for(var key in window.performance.getEntriesByType(\"resource\")[{0}]){{keys.push(key);}} return keys;", name));
            foreach (string property in (System.Collections.ObjectModel.ReadOnlyCollection<object>)resProperties)
            {
                resource.Add(property, ieDriver.ExecuteScript(string.Format("return window.performance.getEntriesByType(\"resource\")[{0}].{1};", name, property)));
            }
            resTimings.Add(name, resource);
        }
这有效,但似乎需要的时间太长了。我敢肯定有很多优化要做。不太了解js,但似乎在那里卸载工作可能会更快。