public PageRefFilteredHar(Har har, String pageRef) { super(new PageRefFilteredHarLog(har.getLog(), pageRef)); } }
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);
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);
@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; }
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); }
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()); }
/** * 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); }
public PageRefFilteredHar(Har har, Set<String> pageRef) { super(new PageRefFilteredHarLog(har.getLog(), pageRef)); }
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);
// 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"); } } }
/** * Utility function for missing virtual screen * @return the report */ public static ExecutionReport noVirtualScreen() { return new ExecutionReport(LoadingTimes.empty(), new Har(), AutomationResult.NO_VIRTUAL_SCREEN); }
public void notifyHarChange(){ if (previewAdapter != null) { harLog = ((MainActivity) getActivity()).getFiltedHar().getLog(); harEntryList.clear(); harEntryList.addAll(harLog.getEntries()); previewAdapter.notifyDataSetChanged(); } }
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);
@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; }
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; }
@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; }
@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); }
@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; }
@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); }
@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); } } }