{"id":17045279,"url":"https://github.com/phanect/playwright-errors","last_synced_at":"2026-04-17T17:32:37.702Z","repository":{"id":141644205,"uuid":"325824315","full_name":"phanect/playwright-errors","owner":"phanect","description":"Automatically collect errors with Playwright","archived":false,"fork":false,"pushed_at":"2021-02-21T15:07:05.000Z","size":12,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-23T02:43:36.498Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/phanect.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":"2020-12-31T15:16:26.000Z","updated_at":"2021-02-21T15:07:07.000Z","dependencies_parsed_at":null,"dependency_job_id":"ca19f2b5-1584-4661-9288-36cee7f818fe","html_url":"https://github.com/phanect/playwright-errors","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/phanect/playwright-errors","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phanect%2Fplaywright-errors","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phanect%2Fplaywright-errors/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phanect%2Fplaywright-errors/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phanect%2Fplaywright-errors/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phanect","download_url":"https://codeload.github.com/phanect/playwright-errors/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phanect%2Fplaywright-errors/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31938742,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-17T17:29:20.459Z","status":"ssl_error","status_checked_at":"2026-04-17T17:28:47.801Z","response_time":62,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":[],"created_at":"2024-10-14T09:36:59.537Z","updated_at":"2026-04-17T17:32:37.672Z","avatar_url":"https://github.com/phanect.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# playwright-errors\n\n![GitHub Actions Status](https://github.com/phanect/sitegazer/workflows/GitHub%20Actions/badge.svg)\n\nplaywright-errors automatically collects browser console errors, network errors, and HTML errors by running browser-automation script of [Playwright](https://playwright.dev/).\n\n## Requirement\n\n- Node.js 10.x, 12.x, 14.x, or 15.x\n- Playwright (latest version recommended)\n- Java 8+ (if you want to collect HTML errors)\n\n## Install\n\n```shell\n$ npm install playwright-errors\n```\n\nor\n\n```shell\n$ yarn add playwright-errors\n```\n\n## Example\n\n```javascript\n\"use strict\";\n\nimport { chromium, firefox, webkit } from \"playwright\";\nimport { initErrorCollector } from \"playwright-errors\";\n\n(async () =\u003e {\n  for (const browserType of [ chromium, firefox, webkit ]) {\n    const browser = await browserType.launch();\n    const { context, collector } = initErrorCollector(await browser.newContext());\n    const page = await context.newPage();\n\n    await page.goto(\"https://playwright.dev/\");\n    await collector.waitForErrorCollection();\n\n    await page.click(\"a[href='/docs/intro']\");\n\n    const issues = await collector.dump();\n    console.log(JSON.stringify(issues, null, 2));\n\n    await browser.close();\n  }\n})();\n```\n\n## API\n\n### `playwright-errors` module\n\n#### function: `initErrorCollector(browserContext, options)`\n\nInitialize error collector for the given `BrowserContext` object.\n\n- `browserContext`: `BrowserContext` - Playwright's `BrowserContext` object to audit.\n- `options`: `object` - Error collection options.\n  - `html`: `boolean` - If `false`, disable collecting HTML errors. `true` by default.\n- returns: `Promise\u003c{ context, collector }\u003e`\n  - `context`: `BrowserContext` - The initialized `BrowserContext` object. `playwright-errors` collects the errors raised in the pages opened in this context.\n  - `collector`: `ErrorCollector` - The `ErrorCollector` object for the corresponding `context`.\n\n### class: `ErrorCollector`\n\n#### method: `waitForErrorCollection()`\n\nWait for `networkidle` and error collection proceess has finished.\nMake sure to put this method before moving to another page to collect errors more accurately.\n\n- returns: `Promise\u003cvoid\u003e`\n\n#### method: `dump()`\n\nReturns collected errors.\n\n- returns: `Promise\u003cErrorCollection[]\u003e`\n\n### interface: `ErrorCollection`\n\nExample:\n\n```javascript\n{\n  \"url\": \"https://example.com/\",\n  \"files\": [\n    {\n      \"url\": \"https://example.com/\",\n      \"issues\": [\n        {\n          \"category\": \"html\",\n          \"message\": \"An “img” element must have an “alt” attribute, except under certain conditions. For details, consult guidance on providing text alternatives for images.\",\n          \"line\": {\n            \"start\": 23,\n            \"end\": 23\n          },\n          \"column\": {\n            \"start\": 7789,\n            \"end\": 7820\n          }\n        },\n        {\n          \"category\": \"html\",\n          \"message\": \"An “img” element must have an “alt” attribute, except under certain conditions. For details, consult guidance on providing text alternatives for images.\",\n          \"line\": {\n            \"start\": 23,\n            \"end\": 23\n          },\n          \"column\": {\n            \"start\": 7877,\n            \"end\": 7906\n          }\n        },\n      ]\n    },\n  ]\n}\n```\n\n#### property: `url`: `string`\n\nPage URL where the errors are raised.\n\n#### property: `files[].url`: `string`\n\nThe file URL where the errors are raised.\nFor example, If the error is raised in https://example.com/a.js which is embedded in https://example.com/, the page URL should be https://example.com/ and the file URL should be https://example.com/a.js.\n\n#### property: `files[].issues[].category`: `\"console\" | \"network\" | \"html\"`\n\nThe category of this issue.\n\n- `console` - Messages from the browser console.\n- `network` - Network request failures.\n- `html` - HTML errors found by Nu HTML Checker.\n\n#### property: `files[].issues[].message`: `string`\n\nThe error/warning message.\n\n#### property: `files[].issues[].line`: `{ start: number, end: number }`\n\nThe line where the error raised.\n\n#### property: `files[].issues[].column`: `{ start: number, end: number }`\n\nThe column where the error raised.\n\n## License\n\n[MIT](https://opensource.org/licenses/MIT)\n\n\u0026copy; 2021 Jumpei Ogawa\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphanect%2Fplaywright-errors","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphanect%2Fplaywright-errors","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphanect%2Fplaywright-errors/lists"}