I want to get the time taken by the page to load using Selnium. So far I am using Selenium4 Devtools option intercepting Network calls.
I used code
System.out.println( "Request URL : " + entry.getResponse().getUrl() + "\n" +"Response-Time: " + entry.getResponse().getResponseTime().get());
However in output I always get 1.6xxxxxxE12
Response-Time: 1.642332111416544E12
Response-Time: 1.642332111418037E12
Response-Time: 1.642332111421922E12
I am not able to understand how to get the Response time in human readabe format ie: Seconds or MilliSecond. I see in doc the return class is Selenium TimeSinceEpoch.
I tried with other websites or url as well, but time is always 1.6xxx
public class Main {
private static ChromeDriver driver;
private static DevTools chromeDevTools;
public static void main(String[] args) {
WebDriverManager.chromedriver().setup();
ChromeOptions options = new ChromeOptions();
driver = new ChromeDriver(options);
chromeDevTools = driver.getDevTools();
chromeDevTools.createSession();
chromeDevTools.send(Network.enable(Optional.empty(), Optional.empty(), Optional.empty()));
chromeDevTools.addListener(
Network.responseReceived(),
entry -> {
System.out.println(
"Request URL : "
+ entry.getResponse().getUrl()
+ "\n"
+ "Response-Time: "
+ entry.getResponse().getResponseTime().get());
});
driver.get("http://www.youtube.com");
chromeDevTools.send(Network.disable());
}
}
Basically all I am trying is to get how much time it takes for Page to Load