Open Jacobvu84 opened 4 years ago
....
private BrowserMobHelper bmpHelper = BrowserMobHelper.getInstance();
....
bmpHelper.startRecording();
......
......
try {
bmpHelper.stopRecording().writeTo(new File(System.currentTimeMillis()+"_jacob.har"));
bmpHelper.stopProxy();
} catch (IOException e) {
e.printStackTrace();
}
.....
openssl x509 -inform pem -in ca-certificate-rsa.cer -outform der -out ca-certificate-rsa.pem
import net.lightbody.bmp.BrowserMobProxy;
import net.lightbody.bmp.BrowserMobProxyServer;
import net.lightbody.bmp.client.ClientUtil;
import net.lightbody.bmp.core.har.Har;
import net.lightbody.bmp.core.har.HarEntry;
import net.lightbody.bmp.core.har.HarRequest;
import net.lightbody.bmp.core.har.HarResponse;
......
for (HarEntry entry : har.getLog().getEntries()) {
HarRequest request = entry.getRequest();
HarResponse response = entry.getResponse();
if(response.getStatus() == 500){
Assert.fail(request.getUrl() + " returns 500 error");
}
System.out.println(response.getStatus() + " : " + request.getUrl()
+ ", " + entry.getTime() + "ms");
assertThat(response.getStatus(), is(200));
}