Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

Export browser HAR data using chrome-har

Shulou Source: shulou.com Published: 2022-06-03 02:51:11 10月04日 Update

< dataArr.length){ iterator(i+1) ; } })(0) ; }); console.log('应用程序启动完成') ;}//执行//init();/** 用于测试的方法*/async function test(){ let ftime = moment().format('YYYYMMDDHHmm'); console.log('当前执行时间为:' + ftime) ; let dirPath = path.join(__dirname,'harlogs',ftime) ; console.log("创建目录:" + dirPath) ; let isExist = false ; if(fs.existsSync(dirPath)){ //创建文件夹 let stat = fs.lstatSync(dirPath); if(stat.isDirectory()){ isExist = true ; } } if(!isExist){ //创建文件夹 console.log("创建文件夹" + ftime) ; fs.mkdirSync(dirPath); } //测试的URL let url = "www.baidu.com" ; let arguments = process.argv.splice(2); if(arguments.length >

0) {url = arguments [0];} url = url.trim (); let filename = url.replace (/\ / / g maijinghui'). Replace (/\ / gjinghui') + '.har'; if (url) {console.log ("starting to resovle test url:" + url) Try {await mhar.saveHarlog (url,dirPath, "NT" + "-" + filename);} catch (error) {console.log (error);} / / run the test test ()

For the code in the GRPC section, please refer to my other blog post

Reference address: https://michaljanaszek.com/blog/generate-har-with-puppeteer

Tags: Browser browse file address page folder data code directory reference processing scheduling good event content function action parameter can be passed size Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno macOS Apple Linux Shulou Technology