net.lightbody.bmp.core.har.Har类的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(7.9k)|赞(0)|评价(0)|浏览(93)

本文整理了Java中net.lightbody.bmp.core.har.Har类的一些代码示例,展示了Har类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Har类的具体详情如下:
包路径:net.lightbody.bmp.core.har.Har
类名称:Har

Har介绍

暂无

代码示例

代码示例来源:origin: JZ-Darkal/AndroidHttpCapture

public PageRefFilteredHar(Har har, String pageRef) {
    super(new PageRefFilteredHarLog(har.getLog(), pageRef));
  }
}

代码示例来源:origin: JZ-Darkal/AndroidHttpCapture

if (har.getLog() == null) {
  return new Har();
for (HarPage page : har.getLog().getPages()) {
  pageRefsToCopy.add(page.getId());
for (HarEntry entry : har.getLog().getEntries()) {
  if (pageRefsToCopy.contains(entry.getPageref())) {
    logCopy.addEntry(entry);
for (HarPage page : har.getLog().getPages()) {
  if (pageRefsToCopy.contains(page.getId())) {
    logCopy.addPage(page);
Har harCopy = new Har();
harCopy.setLog(logCopy);

代码示例来源:origin: stackoverflow.com

if(server.getHar()==null){
   System.out.println("No Har capture");
 }
 Har har = server.getHar();
 if(har==null){
   System.out.println("Har is NULL");
 }
 FileOutputStream fos = new FileOutputStream(FILE_OUTPUT_HAR+"fos"+".har");
 har.writeTo(fos);
 HarLog log = har.getLog();
 if(log==null){
   System.out.println("Harlog is null");
 }
 List<HarEntry> entries = new CopyOnWriteArrayList<HarEntry>(log.getEntries());
     System.out.println("entries"+entries);
     for (HarEntry entry : entries){
       System.out.println("entry="+entry.getRequest().getUrl());
     }
 File harFile = new File(HAR_FILE_PATH+"2"+".har");
 File("/Users/yourpath/"+"2"+".har");        
 har.writeTo(harFile);

代码示例来源:origin: JZ-Darkal/AndroidHttpCapture

@Override
public Har newHar(String initialPageRef, String initialPageTitle) {
  Har oldHar = getHar();
  addHarCaptureFilter();
  harPageCount.set(0);
  this.har = new Har(new HarLog(HAR_CREATOR_VERSION,this));
  newPage(initialPageRef, initialPageTitle);
  return oldHar;
}

代码示例来源:origin: org.jspringbot/jspringbot-selenium

public void saveHar() throws IOException {
  if(lastHar == null) {
    throw new IllegalStateException("No har found.");
  }
  File baseDir = harDir;
  if(CollectionUtils.isNotEmpty(harDirStack)) {
    baseDir = harDirStack.pop();
  }
  File newFile = new File(baseDir, lastName + ".har");
  lastHar.writeTo(newFile);
}

代码示例来源:origin: com.infotel.seleniumRobot/core

public HarCapture(Har har) throws IOException {
  super(har.getLog().getPages().get(0).getTitle(), false, new ArrayList<>());
  harFile = har;
  File harFile = Paths.get(SeleniumTestsContextManager.getThreadContext().getOutputDirectory(), HAR_FILE_NAME).toFile();
  
  har.writeTo(harFile);
  logger.info("HAR capture file copied to " + harFile.getAbsolutePath());
}

代码示例来源:origin: hristo-vrigazov/bromium

/**
 * Utility function for the case when the driver could not be created
 * @return
 */
public static ExecutionReport couldNotCreateDriver() {
  return new ExecutionReport(LoadingTimes.empty(), new Har(), AutomationResult.COULD_NOT_CREATE_DRIVER);
}

代码示例来源:origin: JZ-Darkal/AndroidHttpCapture

public PageRefFilteredHar(Har har, Set<String> pageRef) {
  super(new PageRefFilteredHarLog(har.getLog(), pageRef));
}

代码示例来源:origin: misakuo/Dream-Catcher

if (har.getLog() == null) {
  return new Har();
for (HarPage page : har.getLog().getPages()) {
  pageRefsToCopy.add(page.getId());
for (HarEntry entry : har.getLog().getEntries()) {
  if (pageRefsToCopy.contains(entry.getPageref())) {
    logCopy.addEntry(entry);
for (HarPage page : har.getLog().getPages()) {
  if (pageRefsToCopy.contains(page.getId())) {
    logCopy.addPage(page);
Har harCopy = new Har();
harCopy.setLog(logCopy);

代码示例来源:origin: stackoverflow.com

// create a new har with given label
public void setHar(String label) {
  server.newHar(label);
}

public void getHar() throws IOException {
  // FIXME : What should be done with the this data?
  Har har = server.getHar();
  if (har == null) return;
  File harFile = new File("C:\\localdev\\bla.har");
  har.writeTo(harFile);
  for (HarEntry entry : har.getLog().getEntries()) {
    // Check for any 4XX and 5XX HTTP status codes
    if ((String.valueOf(entry.getResponse().getStatus()).startsWith("4"))
        || (String.valueOf(entry.getResponse().getStatus()).startsWith("5"))) {
      log.warn(String.format("%s %d %s", entry.getRequest().getUrl(), entry.getResponse().getStatus(),
          entry.getResponse().getStatusText()));
      //throw new UnsupportedOperationException("Not implemented");
    }
  }
}

代码示例来源:origin: hristo-vrigazov/bromium

/**
 * Utility function for missing virtual screen
 * @return the report
 */
public static ExecutionReport noVirtualScreen() {
  return new ExecutionReport(LoadingTimes.empty(), new Har(), AutomationResult.NO_VIRTUAL_SCREEN);
}

代码示例来源:origin: JZ-Darkal/AndroidHttpCapture

public void notifyHarChange(){
  if (previewAdapter != null) {
    harLog = ((MainActivity) getActivity()).getFiltedHar().getLog();
    harEntryList.clear();
    harEntryList.addAll(harLog.getEntries());
    previewAdapter.notifyDataSetChanged();
  }
}

代码示例来源:origin: net.lightbody.bmp/browsermob-core

if (har.getLog() == null) {
  return new Har();
for (HarPage page : har.getLog().getPages()) {
  pageRefsToCopy.add(page.getId());
for (HarEntry entry : har.getLog().getEntries()) {
  if (pageRefsToCopy.contains(entry.getPageref())) {
    logCopy.addEntry(entry);
for (HarPage page : har.getLog().getPages()) {
  if (pageRefsToCopy.contains(page.getId())) {
    logCopy.addPage(page);
Har harCopy = new Har();
harCopy.setLog(logCopy);

代码示例来源:origin: net.lightbody.bmp/browsermob-core

@Override
public Har newHar(String initialPageRef, String initialPageTitle) {
  Har oldHar = getHar();
  addHarCaptureFilter();
  harPageCount.set(0);
  this.har = new Har(new HarLog(HAR_CREATOR_VERSION));
  newPage(initialPageRef, initialPageTitle);
  return oldHar;
}

代码示例来源:origin: JZ-Darkal/AndroidHttpCapture

public Set<String> getPageSet() {
  BrowserMobProxy proxy = ((SysApplication) getApplication()).proxy;
  Set<String> pageSet = new HashSet<>();
  for (HarPage harPage : proxy.getHar().getLog().getPages()) {
    if (!disablePages.contains(harPage.getId())) {
      pageSet.add(harPage.getId());
    }
  }
  return pageSet;
}

代码示例来源:origin: misakuo/Dream-Catcher

@Override
public Har newHar(String initialPageRef, String initialPageTitle) {
  Har oldHar = getHar();
  addHarCaptureFilter();
  harPageCount.set(0);
  this.har = new Har(new HarLog(HAR_CREATOR_VERSION));
  newPage(initialPageRef, initialPageTitle);
  return oldHar;
}

代码示例来源:origin: JZ-Darkal/AndroidHttpCapture

@Override
public void proxyToServerConnectionFailed() {
  // since this is a CONNECT, which is not handled by the HarCaptureFilter, we need to create and populate the
  // entire HarEntry and add it to this har.
  HarEntry harEntry = createHarEntryForFailedCONNECT(HarCaptureUtil.getConnectionFailedErrorMessage());
  har.getLog().addEntry(harEntry);
  // record the amount of time we attempted to connect in the HarTimings object
  if (connectionStartedNanos > 0L) {
    harEntry.getTimings().setConnect(System.nanoTime() - connectionStartedNanos, TimeUnit.NANOSECONDS);
  }
  httpConnectTimes.remove(clientAddress);
}

代码示例来源:origin: net.lightbody.bmp/browsermob-core-littleproxy

@Override
public Har newHar(String initialPageRef, String initialPageTitle) {
  // eagerly initialize the User Agent String Parser, since it will be needed for the HAR
  BrowserMobProxyUtil.getUserAgentStringParser();
  Har oldHar = getHar();
  addHarCaptureFilter();
  harPageCount.set(0);
  this.har = new Har(new HarLog(HAR_CREATOR_VERSION));
  newPage(initialPageRef, initialPageTitle);
  return oldHar;
}

代码示例来源:origin: JZ-Darkal/AndroidHttpCapture

@Override
public void proxyToServerResolutionFailed(String hostAndPort) {
  // since this is a CONNECT, which is not handled by the HarCaptureFilter, we need to create and populate the
  // entire HarEntry and add it to this har.
  HarEntry harEntry = createHarEntryForFailedCONNECT(HarCaptureUtil.getResolutionFailedErrorMessage(hostAndPort));
  har.getLog().addEntry(harEntry);
  // record the amount of time we attempted to resolve the hostname in the HarTimings object
  if (dnsResolutionStartedNanos > 0L) {
    harEntry.getTimings().setDns(System.nanoTime() - dnsResolutionStartedNanos, TimeUnit.NANOSECONDS);
  }
  httpConnectTimes.remove(clientAddress);
}

代码示例来源:origin: JZ-Darkal/AndroidHttpCapture

@Override
  public void onClick(View view) {
    if(harLog.getEntries().indexOf(harEntry)>=0) {
      isHiddenHID = true;
      Intent intent = new Intent(getContext(), HarDetailActivity.class);
      intent.putExtra("pos", ((SysApplication) getActivity().getApplication()).proxy.
          getHar().getLog().getEntries().indexOf(harEntry));
      getActivity().startActivity(intent);
    }
  }
}

相关文章