有一個新的規格被引入到所有現代瀏覽器。目前谷歌瀏覽器,IE9已經內置,Mozilla正在等待應用已經提供的補丁。
這種新規範被稱爲WebTimings,我寫了一個blog post展示瞭如何使用C#來訪問它。訪問它的方式是通過javascript,因此可以與所有語言綁定一起使用。
中的JavaScript需要的是
var performance = window.performance || window.webkitPerformance || window.mozPerformance window.msPerformance || {};
var timings = performance.timing || {};
return timings;
這將返回一個字典是這樣
/* The dictionary returned will contain something like the following.
* The values are in milliseconds since 1/1/1970
*
* connectEnd: 1280867925716
* connectStart: 1280867925687
* domainLookupEnd: 1280867925687
* domainLookupStart: 1280867925687
* fetchStart: 1280867925685
* legacyNavigationStart: 1280867926028
* loadEventEnd: 1280867926262
* loadEventStart: 1280867926155
* navigationStart: 1280867925685
* redirectEnd: 0
* redirectStart: 0
* requestEnd: 1280867925716
* requestStart: 1280867925716
* responseEnd: 1280867925940
* responseStart: 1280867925919
* unloadEventEnd: 1280867925940
*/
大文章,但我怕你會告訴我,我們不能在硒1.0.8做到這一點。這是1.0.8還是需要Selenium 2測試版?另外,最新的計時對象聽起來像是它們不適用於Firefox 3,這是正確的嗎? – MADCookie 2010-12-01 19:36:43