2012-02-09 79 views

回答

0

事實證明,你可以使用新的Web API時序:

System.setProperty("webdriver.chrome.driver","/home/joel/dev/libs/chrome-web-driver/chromedriver"); 
WebDriver driver = new ChromeDriver(); 
     driver.get("http://www.google.com"); 
     JavascriptExecutor js =((JavascriptExecutor) driver); 
     Object val = js.executeScript("" + 
       "try{window.performance = window.performance || window.mozPerformance || window.msPerformance || window.webkitPerformance || {};" + 
       "return(parseInt(window.performance.timing.domContentLoadedEventEnd)-parseInt(window.performance.timing.navigationStart));}catch(e){alert(e);}"); 
     System.out.println(val.toString());