{"id":15177596,"url":"https://github.com/tompascall/web-log","last_synced_at":"2026-03-01T11:33:13.220Z","repository":{"id":79939240,"uuid":"82393041","full_name":"tompascall/web-log","owner":"tompascall","description":"test utility for e2e tests","archived":false,"fork":false,"pushed_at":"2017-07-09T12:29:07.000Z","size":52,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-31T16:45:24.441Z","etag":null,"topics":["chromedriver","e2e-testing","network-analysis","network-test","network-traffic","selenium-webdriver","testing-tools","webdriver"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tompascall.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-02-18T14:42:28.000Z","updated_at":"2017-07-09T12:02:56.000Z","dependencies_parsed_at":"2023-03-12T09:29:20.827Z","dependency_job_id":null,"html_url":"https://github.com/tompascall/web-log","commit_stats":{"total_commits":68,"total_committers":2,"mean_commits":34.0,"dds":0.02941176470588236,"last_synced_commit":"58c38cec2b1243624f8809956b2d03a68da70b32"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tompascall/web-log","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tompascall%2Fweb-log","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tompascall%2Fweb-log/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tompascall%2Fweb-log/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tompascall%2Fweb-log/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tompascall","download_url":"https://codeload.github.com/tompascall/web-log/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tompascall%2Fweb-log/sbom","scorecard":{"id":893175,"data":{"date":"2025-08-11","repo":{"name":"github.com/tompascall/web-log","commit":"58c38cec2b1243624f8809956b2d03a68da70b32"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.6,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-24T12:39:32.241Z","repository_id":79939240,"created_at":"2025-08-24T12:39:32.241Z","updated_at":"2025-08-24T12:39:32.241Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29968491,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-01T10:55:55.490Z","status":"ssl_error","status_checked_at":"2026-03-01T10:55:55.175Z","response_time":124,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chromedriver","e2e-testing","network-analysis","network-test","network-traffic","selenium-webdriver","testing-tools","webdriver"],"created_at":"2024-09-27T14:40:52.247Z","updated_at":"2026-03-01T11:33:13.199Z","avatar_url":"https://github.com/tompascall.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Build Status](https://travis-ci.org/tompascall/web-log.svg?branch=master) [![Coverage Status](https://coveralls.io/repos/tompascall/web-log/badge.svg?branch=master)](https://coveralls.io/r/tompascall/web-log?branch=master)\n\n\n# web-log\n## nodejs e2e test utility for testing network traffic\n\nThis utility helps you testing network traffic in your selenium e2e tests. If you don't know much about selenium webdriver and how to use it with node, I recommend you to check its usage in the [webdriver documentation](http://seleniumhq.github.io/selenium/docs/api/javascript/index.html). You can find a demo at the bottom of this file, where we use some basic feature of webdriver. \n\nWhen you write e2e tests, sometimes you would like to check the network traffic during between changes of the state of your application. You may want to know for example if an ajax request has really been sent (say with the correct query params) after a button was clicked, or you would like to check if the response was correct. \n\nA solution for this problem can be getting and filtering the log entries extracted from selenium webdriver network log:\n\n```js\nconst { driverUtil, logEntries } = require('web-log');\n\n//  use your previously configured web driver instance, \n//  or you can use the built-in driver config as below.\n\nconst driver = driverUtil.createDriver({type: 'chrome'});\n\ndriver.get('https://search.yahoo.com/')\n.then( () =\u003e {\n  return logEntries.getLogEntries({ driver });\n})\n.then( (entries) =\u003e {\n  let filteredEntries = logEntries.filterEntries({\n    entries,\n    urlPart: 'images/ff_icon-compressed.png',\n    method: 'Network.requestWillBeSent'\n  });\n  console.log(JSON.stringify(filteredEntries));\n});\n```\n\nYou'll get something like this:\n\n```js\n[\n  {\n    \"message\": {\n      \"method\": \"Network.requestWillBeSent\",\n      \"params\": {\n        \"documentURL\": \"https://search.yahoo.com/\",\n        \"frameId\": \"34828.1\",\n        \"initiator\": {\n          \"lineNumber\": 2,\n          \"type\": \"parser\",\n          \"url\": \"https://search.yahoo.com/\"\n        },\n        \"loaderId\": \"34828.1\",\n        \"request\": {\n          \"headers\": {\n            \"Referer\": \"https://search.yahoo.com/\",\n            \"User-Agent\": \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.95 Safari/537.36\"\n          },\n          \"initialPriority\": \"Low\",\n          \"method\": \"GET\",\n          \"mixedContentType\": \"none\",\n          \"url\": \"https://s.yimg.com/kx/yucs/uh3s/promo-ff/1/images/ff_icon-compressed.png\"\n        },\n        \"requestId\": \"34828.3\",\n        \"timestamp\": 162088.788968,\n        \"type\": \"Other\",\n        \"wallTime\": 1486295567.13642\n      }\n    },\n    \"webview\": \"92d5054b-9d84-4399-8d74-9c0c9d0393d4\"\n  }\n]\n```\nAs you can see there are a lot of information available by filtering the log data of the webdriver. The main aim of this utility is to make filtering and analyzing the log easier and help you for setting up the webdriver to get the log data.\n\n## Prerequisites\n\n- Nodejs (at least v6.1)\n\n- For the moment the tool only works with [chromedriver](https://sites.google.com/a/chromium.org/chromedriver/getting-started)\u003csup\u003e*\u003c/sup\u003e. You have to install it if you haven't done yet.\n\n- Install the package: `npm -i save-dev web-log`  \n\n\u003csup\u003e*\u003c/sup\u003eThe logging interface supported by Selenium isn’t available in geckodriver yet. Read more about this issue [here](https://github.com/mozilla/geckodriver/issues/284).\n\n## Usage\n\n### logEntries\n\nYou can use logEntries module by requiring it from the main module:  \n\n```js\nconst { logEntries } = require('web-log');\n```\n\nlogEntries module gets the raw entry data, transforms it to a JSON object, and has filter utilities to filter entries in quite a flexible way. You can use the following methods:\n\n#### getRawEntries ({ driver }): promise (the result is an array)\n\nGets the raw performance log data. It is an array which contains **raw** entry objects (ie. we have not done any transformation in the data). You have to provide a webdriver object to get the raw log data. Check a basic example for setting up a driver object in the demo block.\n\n#### getLogEntries ({ driver }) : promise (result is an array)\n\nIt gets raw entries and transforms the message part of the entry to a JSON format object. This method is ideal for getting all the log data, and after that you may want to filter entries with the filter utilities. **Getting entries clears the log content of the driver**, so you have to make all operation on entries data before getting log entries again, and it means you can use this method if you only want to clear entries from the driver. All the filters and matchers work on entries got by this method, but not on the raw entry data. So a basic workflow can be getting the data via this method, and after that you can use the filter utilities below:\n\n```js\nconst { logEntries, driverUtils } = require('web-log');\nconst driver = driverUtil.createDriver({type: 'chrome'});\n\nlogEntries.getLogentries({ driver }).then( (entries) =\u003e {\n  ... filter entries here\n})\n```\n\n#### clearLogEntries ({ driver }) : promise (result is an array)\n\nUtility function for clearing logEntries. It is a wrapper around `getLogEntries()` method.  \n\n#### getRequests ({ entries }) : Array\n\nFilters the request objects from entries.\n\n#### filterEntries ({entries, method?, urlPart?, refParams?, status?, predicate?, dupAlert?}) : array of filtered entries or false if no match\n\nIt needs entries you got previously via `getLogentries()` method. You can filter the entries quite comfortably with the following options:\n\n- **method** can be\n  - 'Network.requestWillBeSent'\n  - 'Network.requestServedFromCache'\n  - 'Network.responseReceived'\n  - 'Network.dataReceived'\n  - 'Network.loadingFinished'\n  - 'Network.loadingFailed'\n- **urlPart** can be a string or a regex to filter the url of a request or a response\n- **refParams** is an object with key:value pairs of params `{ param1: 'value1', param2: 'value2' }`. These are params you want to check if a given url query contains. You do not have to give all the params of url, just the ones you want to check.\n- **status** can be a string or a regex (it is only reasonable when method is `Network.responseReceived`)\n- **predicate** can be any filter function which works on entry (eg. `entry =\u003e { any function that returns boolean }`)\n- **dupAlert** is a boolean with the false default value. You want to use it if yau want to make sure a eg. a request with the given params is sent just only once. In case of duplication you'll get an error message.\n\nSo we can write a test even with more filters like this (suppose we use mocha and chai for tests):\n\n```js\nconst { logEntries, driverUtils } = require('web-log');\nconst driver = driverUtil.createDriver({type: 'chrome'});\n\ndescribe('test yahoo search landig page', () =\u003e {\n  before( () =\u003e {\n    return logEntries.getLogentries({ driver }) // clear driver log entries\n      .then( () =\u003e {\n         return driver.get('https://search.yahoo.com/')\n      });\n  });\n\n  it('should have loaded a firefox icon from s.yimg.com', () =\u003e {\n    return logEntries.getLogEntries({ driver })\n      .then( (entries) =\u003e {\n        let matched = logEntries.filterEntries({\n          entries,\n          urlPart: /s\\.yimg\\.com.+images\\/ff_icon\\-compressed\\.png$/,\n          method: 'Network.responseReceived',\n          status: /[23]\\d\\d/,\n          dupAlert: true\n        });\n        expect(matched.length).to.be.ok;\n      });\n  });\n});\n```\n\nYou can use the following built-in fiter methods directly if you want. Built-in filter methods have the same form:\n- you have to provide entries got from `logEntries.getLogEntries() method prevously`\n- they give back a self reference for the object for chainability  \n- You can reach the result in filteredEntries attribute  \n- If you do not provide params, they give back all the entries\n\n#### filterByStatus({ entries, [status: regex | string]? })\n\n```js\n  const filteredEntries = logEntries.filterByStatus({entries: previouslyGotEntries, status: 'someString'}).filteredEntries;\n```\n\n#### filterByMethod({ entries, [method: string]? }) : self reference\n\n#### filterByRefParams({ entries, [refParams: object ]? }) : self reference\n\n#### filterByUrlPart({ entries, [refParams: string | regex ]? }) : self reference\n\n#### filterByPredicate({ entries, [predicate: function]? }) : self reference\n\nPredicate can be any filter function which works on item of entries (eg. `entry =\u003e { any function that returns boolean }`)\n\n### logEntry\n\nlogEntry module operates on single entry object.\n\n#### getMethod ({ entry }) : string\n\nGet method of entry.\n\n```js\nconst { logEntries, logEntry } = require('web-log');\n\n// getting entries\n// and work on on of them\n\nlogEntry.getMethod({ entry }) // Network.requestWillBeSent\n```\n\n#### getUrl ({ entry }) : string\n\nGet url of entry.\n```js\nlogEntry.getUrl({ entry }) // \"https://s.yimg.com/kx/yucs/uh3s/promo-ff/1/images/ff_icon-compressed.png\"\n```\n\n#### getStatus ({ entry }) : string\n\nGet status of entry (checks only 'Network.responseReceived' methods).\n```js\nlogEntry({ entry }) // \"200\"\n```\n\n## Demo\n\nIn the demo we navigate to a page and fiter a small part of the log entries.   \nTo run demo: `node demo/demo.js`  \n\n## Development\n\nWe use [Jest](https://facebook.github.io/jest/) for unit testing. You can run tests with `npm run test` or `npm run test:watch` for only watching changed file.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftompascall%2Fweb-log","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftompascall%2Fweb-log","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftompascall%2Fweb-log/lists"}