Hello,
I have generated .HAR files using Selenium Web Driver with BrowserMob Proxy(SWD+BM) and by using webpagetest.org(WPT). I used HAR Storage to view these files. The following are the differences I found.
a. All the sizes and times(Load Time, DNS Time, Transfer Time etc.) shown in SWD+BM are less compared to WPT.
b. No. of resources by request(images, css, html etc. ), resources by size, domains by request, domains by size in SWD+BM are less in number or equal to(mostly less) when compared to WPT.
I have used Firefox browser for the both.
Why are these differences? Is there any architecture difference b/w these two?
The code I used for BMP is:
import java.io.FileOutputStream;
import org.browsermob.core.har.Har;
import org.browsermob.proxy.ProxyServer;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
public class SeleniumWDBMHAR {
public static void main(String[] args) throws Exception {
// TODO Auto-generated method stub
ProxyServer server = new ProxyServer(4461);
server.start();
server.setCaptureHeaders(true);
server.setCaptureContent(true);
// get the Selenium proxy object
org.openqa.selenium.Proxy proxy = server.seleniumProxy();
// configure it as a desired capability
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(CapabilityType.PROXY, proxy);
// start the browser up
WebDriver driver = new FirefoxDriver(capabilities);
server.newHar("xxx");
driver.get("xxx");
// get the HAR data
Har har = server.getHar();
String strFilePath = "Selenium_test.har";
FileOutputStream fos = new FileOutputStream(strFilePath);
har.writeTo(fos);
server.stop();
}
}
I have generated .HAR files using Selenium Web Driver with BrowserMob Proxy(SWD+BM) and by using webpagetest.org(WPT). I used HAR Storage to view these files. The following are the differences I found.
a. All the sizes and times(Load Time, DNS Time, Transfer Time etc.) shown in SWD+BM are less compared to WPT.
b. No. of resources by request(images, css, html etc. ), resources by size, domains by request, domains by size in SWD+BM are less in number or equal to(mostly less) when compared to WPT.
I have used Firefox browser for the both.
Why are these differences? Is there any architecture difference b/w these two?
The code I used for BMP is:
import java.io.FileOutputStream;
import org.browsermob.core.har.Har;
import org.browsermob.proxy.ProxyServer;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
public class SeleniumWDBMHAR {
public static void main(String[] args) throws Exception {
// TODO Auto-generated method stub
ProxyServer server = new ProxyServer(4461);
server.start();
server.setCaptureHeaders(true);
server.setCaptureContent(true);
// get the Selenium proxy object
org.openqa.selenium.Proxy proxy = server.seleniumProxy();
// configure it as a desired capability
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(CapabilityType.PROXY, proxy);
// start the browser up
WebDriver driver = new FirefoxDriver(capabilities);
server.newHar("xxx");
driver.get("xxx");
// get the HAR data
Har har = server.getHar();
String strFilePath = "Selenium_test.har";
FileOutputStream fos = new FileOutputStream(strFilePath);
har.writeTo(fos);
server.stop();
}
}