title: how to measure response time for both loading and search time for a website ? selenium
body: <p>I need to measure response time for website using Selenium and Selenide.</p>
  
  <ul>
  <li><p>Response time of a website: </p>
  
  <p>I mean the loading time, I see that there is method to take difference between time before and after open website.</p>
  
  <p>But this way, will measure the client loading time, will it depend on the used client? What is the best way for do that?</p></li>
  <li><pre><code>long startTime = System.currentTimeMillis();
  
  driver.get("http://zyxware.com");
  new WebDriverWait(driver, 10).until(ExpectedConditions.presenceOfElementLocated(By.id("Calculate")));
  
  long endTime = System.currentTimeMillis();
  long totalTime = endTime - startTime;
  
  System.out.println("Total Page Load Time: " + totalTime + "milliseconds");
  </code></pre></li>
  </ul>
  
  <p>or this?</p>
  
  <pre><code>driver.get("url");
          WebElement ele = $(By.tagName("body"));
          // get the  page load time
          Long loadtime = (Long)((JavascriptExecutor)driver).executeScript(
              "return performance.timing.loadEventEnd - performance.timing.navigationStart;");        
          System.out.println(loadtime);
  </code></pre>
  
  <p>and last way the following:</p>
  
  <pre><code>StopWatch pageLoad = new StopWatch();
              pageLoad.start();
              //Open your web app (In my case, I opened facebook)
              driver.get("url");
              // Wait for the required any element (I am waiting for Login button in fb)
              WebDriverWait wait = new WebDriverWait(driver, 10);
              wait.until(ExpectedConditions.presenceOfElementLocated(By.tagName("body")));
  
              pageLoad.stop();
              //Get the time
              long pageLoadTime_ms = pageLoad.getTime();
              long pageLoadTime_Seconds = pageLoadTime_ms / 1000;
              System.out.println("Total Page Load Time: " + pageLoadTime_ms + " milliseconds");
  </code></pre>
  
  <ul>
  <li>If I have a search button for the same website, if I need to measure the search time, how to do it? Is it as same as the above way?</li>
  </ul>