In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
1, environment
1)Firefox 45.0
Download address: ftp.mozilla.org/pub/firefox/releases
2)harexporttrigger-0.5.0-beta.10.xpi
Download address: www.softwareishard.com/blog/har-export-trigger/
https://github.com/firebug/har-export-trigger/releases
3)selenium-java-2.53.1.jar
org.seleniumhq.selenium selenium-java public static String BROWSER_PATH = "C:\\Program Files\\Mozilla Firefox\\firefox.exe";public static String HAR_EXPORTTRIGGER_PATH = "D:\\firefoxpi\\harexporttrigger-0.5.0-beta.10.xpi" ;private final static String HARDIR = "d:\\firefoxharlog";public void init() { System.setProperty("webdriver.firefox.bin", BROWSER_PATH); }private FirefoxProfile buildNetmonitorProfile() throws IOException { FirefoxProfile profile = new FirefoxProfile(); // Load extensions File harExport = new File(HAR_EXPORTTRIGGER_PATH); //adjust path as needed profile.addExtension(harExport); // Enable the automation without having a new HAR file created for every loaded page. profile.setPreference("extensions.netmonitor.har.enableAutomation", true); // Set to a token that is consequently passed into all HAR API calls to verify the user. profile.setPreference("extensions.netmonitor.har.contentAPIToken", "test"); // Set if you want to have the HAR object available without the developer toolbox being open. profile.setPreference("extensions.netmonitor.har.autoConnect", true); // Enable netmonitor profile.setPreference("devtools.netmonitor.enabled", true); // If set to true the final HAR file is zipped. This might represents great disk-space optimization especially if HTTP response bodies are included. profile.setPreference("devtools.netmonitor.har.compress", false); // Default name of the target HAR file. The default file name supports formatters profile.setPreference("devtools.netmonitor.har.defaultFileName", "Autoexport_%y%m%d_%H%M%S"); // Default log directory for generate HAR files. If empty all automatically generated HAR files are stored in /har/logs profile.setPreference("devtools.netmonitor.har.defaultLogDir", HARDIR); // If true, a new HAR file is created for every loaded page automatically. profile.setPreference("devtools.netmonitor.har.enableAutoExportToFile", true); // The result HAR file is created even if there are no HTTP requests. profile.setPreference("devtools.netmonitor.har.forceExport", true); // If set to true, HTTP response bodies are also included in the HAR file (can produce significantly bigger amount of data). profile.setPreference("devtools.netmonitor.har.includeResponseBodies", false); // If set to true the export format is HARP (support for JSONP syntax that is easily transferable cross domains) profile.setPreference("devtools.netmonitor.har.jsonp", false); // Default name of JSONP callback (used for HARP format) profile.setPreference("devtools.netmonitor.har.jsonpCallback", false); // Amount of time [ms] the auto-exporter should wait after the last finished request before exporting the HAR file. profile.setPreference("devtools.netmonitor.har.pageLoadedTimeout", "2500"); //to prevent Firefox >= 65 from automatically updating whilst under automation. //profile.setPreference("app.update.disabledForTesting", "true"); //profile.setPreference("devtools.console.stdout.content", "true"); return profile ;}public void resovle(String url) throws Exception { WebDriver driver = null; try { FirefoxProfile profile = buildNetmonitorProfile() ; driver = new FirefoxDriver(profile); //path to Har data (directory) final File harDir = new File(HARDIR); //Get the current number of files [used to determine whether the file is generated below] final int numFiles = harDir.listFiles().length; //Access resources driver.get(url); //wait for the HAR file to be created for (int c=0; c numFiles) { break; } Thread.sleep(1000L); } } catch (Exception exc) { System.err.println("error --> " + exc); } if (driver != null) { driver.quit(); } }
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.