// also augment the HAR with some stuff
String href = (String) driver.executeScript("return window.location.href;");
if (href.contains("#")) {
href = href.substring(0, href.indexOf("#"));
}
HarPage page = null;
for (HarEntry entry : har.getLog().getEntries()) {
if (href.equals(entry.getRequest().getUrl())) {
for (HarPage harPage : har.getLog().getPages()) {
if (harPage.getId().equals(entry.getPageref())) {
page = harPage;
break;
}
}
}
if (page != null) {
break;
}
}
if (page != null) {
page.setTitle((String) driver.executeScript("return window.document.title;"));
page.setStartedDateTime(new Date(navigationStart));
HarPageTimings pageTimings = new HarPageTimings();
pageTimings.setOnContentLoad(domContentLoadedEventEnd - navigationStart);
pageTimings.setOnLoad(loadEventEnd - navigationStart);
page.setPageTimings(pageTimings);
}
}