{"_id":"@ajaysrikumar/webdriverio-axe-core","name":"@ajaysrikumar/webdriverio-axe-core","dist-tags":{"latest":"4.10.2"},"versions":{"4.10.2":{"name":"@ajaysrikumar/webdriverio-axe-core","version":"4.10.2","description":"Provides a method to inject and analyze web pages using axe","contributors":[{"name":"Michael Siek","url":"me@michaelsiek.com"}],"repository":{"type":"git","url":"git+https://github.com/dequelabs/axe-core-npm.git"},"license":"MPL-2.0","main":"./dist/index.js","module":"./dist/index.mjs","types":"./dist/index.d.ts","exports":{".":{"import":"./dist/index.mjs","require":"./dist/index.js","types":"./dist/index.d.ts"}},"scripts":{"prebuild":"rimraf dist","build":"tsup src/index.ts --dts --format esm,cjs","test":"mocha --timeout 60000 -r ts-node/register 'test/**.spec.ts'","test:export":"npm run test:esm && npm run test:commonjs && npm run test:ts","test:esm":"node test/esmTest.mjs","test:commonjs":"node test/commonjsTest.js","test:ts":"tsc test/tsTest.ts --noEmit --skipLibCheck --esModuleInterop","coverage":"nyc npm run test"},"keywords":["a11y","unit","testing","tdd","bdd","accessibility","axe","webdriver","webdriverio"],"dependencies":{"axe-core":"~4.10.2","cssesc":"^3.0.0"},"devDependencies":{"@types/chai":"^4.3.3","@types/chromedriver":"^81.0.1","@types/cssesc":"^3.0.0","@types/express":"^4.17.14","@types/mocha":"^10.0.6","@types/node":"^22.0.2","@wdio/globals":"^8.27.0","async-listen":"^3.0.1","axe-test-fixtures":"github:dequelabs/axe-test-fixtures#v1","chai":"^4.3.6","cross-dirname":"^0.1.0","delay":"^5.0.0","devtools":"^8.27.2","express":"^4.18.2","mocha":"^10.0.0","nyc":"^17.1.0","rimraf":"^6.0.1","source-map-support":"^0.5.21","ts-node":"^10.9.1","tsup":"^8.0.1","typescript":"^5.2.2","webdriverio":"^8.8.2"},"peerDependencies":{"webdriverio":"^5 || ^6 || ^7 || ^8 || ^9"},"publishConfig":{"access":"public"},"nyc":{"include":["src/index.ts"],"extension":[".ts"],"reporter":["text-summary","html"],"sourceMap":true,"instrument":true,"checkCoverage":true,"statements":85,"branches":85,"functions":85,"lines":85},"_id":"@ajaysrikumar/webdriverio-axe-core@4.10.2","gitHead":"618d2e77a4f31d2ec5c4c9d17f1a58567d80078d","bugs":{"url":"https://github.com/dequelabs/axe-core-npm/issues"},"homepage":"https://github.com/dequelabs/axe-core-npm#readme","_nodeVersion":"22.12.0","_npmVersion":"10.9.0","dist":{"integrity":"sha512-QjB12QbHAJrw8sWDJD6kVp4F56C0wQ4LHkrtsMeM1c+D7RTXNeHwEnMO2N/O5Co7gq+7zo1l78KzIg7F/cvSCA==","shasum":"2ac8f83c8f6f7d064c6702e0d8bbdf036b28ce28","tarball":"https://registry.npmjs.org/@ajaysrikumar/webdriverio-axe-core/-/webdriverio-axe-core-4.10.2.tgz","fileCount":6,"unpackedSize":47565,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIAMrog68Gor0JFHQr51HyKzas/8svFbnxiyKroDCETaeAiEAjasXZql7ac+83qTU4o0Gn9K7sBpyvz/KgRVKCAIniXE="}]},"_npmUser":{"name":"ajaysrikumar","email":"ajay600@gmail.com"},"directories":{},"maintainers":[{"name":"ajaysrikumar","email":"ajay600@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/webdriverio-axe-core_4.10.2_1744621221863_0.7435962162640981"},"_hasShrinkwrap":false}},"time":{"created":"2025-04-14T09:00:21.759Z","4.10.2":"2025-04-14T09:00:22.041Z","modified":"2025-04-14T09:00:22.266Z"},"maintainers":[{"name":"ajaysrikumar","email":"ajay600@gmail.com"}],"description":"Provides a method to inject and analyze web pages using axe","homepage":"https://github.com/dequelabs/axe-core-npm#readme","keywords":["a11y","unit","testing","tdd","bdd","accessibility","axe","webdriver","webdriverio"],"repository":{"type":"git","url":"git+https://github.com/dequelabs/axe-core-npm.git"},"contributors":[{"name":"Michael Siek","url":"me@michaelsiek.com"}],"bugs":{"url":"https://github.com/dequelabs/axe-core-npm/issues"},"license":"MPL-2.0","readme":"# @axe-core/webdriverio\n\n> Provides a chainable axe API for WebdriverIO and automatically injects into all frames.\n\n## Feature Deprecation Notice\n\nSupport for `@wdio/sync` is deprecated and testing for it will be removed in a future release.\n\n## WebDriver Bidi Support\n\nWe're aware of an [issue](https://github.com/dequelabs/axe-core-npm/issues/1144) that occurs when using [WebdriverIO v9](https://webdriver.io/blog/2024/08/15/webdriverio-v9-release) and the [WebDriver Bidi protocol](https://w3c.github.io/webdriver-bidi/). We're investigating this issue and plan to update the community more thoroughly in early 2025.\n\nIf you are encountering this issue and wish to share your experience please add to the [GitHub issue](https://github.com/dequelabs/axe-core-npm/issues/1144).\n\n## Getting Started\n\nInstall [Node.js](https://docs.npmjs.com/getting-started/installing-node) if you haven't already.\n\n> Download and install any necessary browser drivers on your machine's PATH. [More on WebdriverIO setup](https://v6.webdriver.io/docs/gettingstarted.html#taking-the-first-step).\n\nTo install the latest version of Chromedriver globally, install browser-driver-manager: `npm install -g browser-driver-manager`. Then run `npx browser-driver-manager install chrome`.\n\nInstall WebdriverIO: `npm install webdriverio`\n\nInstall @axe-core/webdriverio: `npm install @axe-core/webdriverio`\n\n## Usage\n\nThis module uses a chainable API to assist in injecting, configuring, and analyzing axe with WebdriverIO. As such, it is required to pass an instance of WebdriverIO.\n\nHere is an example of a script that will drive WebdriverIO to a page, perform an analysis, and then log results to the console.\n\n```js\nconst { AxeBuilder } = require('@axe-core/webdriverio');\nconst { remote } = require('webdriverio');\n\n(async () => {\n  const client = await remote({\n    logLevel: 'error',\n    capabilities: {\n      browserName: 'chrome',\n      'goog:chromeOptions': {\n        args: ['headless', 'disable-gpu']\n      }\n    }\n  });\n  await client.url('https://dequeuniversity.com/demo/mars/');\n\n  try {\n    const results = await new AxeBuilder({ client }).analyze();\n    console.log(results);\n  } catch (e) {\n    // do something with the error\n  }\n\n  client.deleteSession();\n})();\n```\n\n### AxeBuilder#analyze(): Promise<axe.Results | Error>\n\nPerforms analysis and passes any encountered error and/or the result object.\n\n```js\nnew AxeBuilder({ client }).analyze((err, results) => {\n  if (err) {\n    // Do something with error\n  }\n  console.log(results);\n});\n```\n\n```js\nnew AxeBuilder({ client })\n  .analyze()\n  .then(results => {\n    console.log(results);\n  })\n  .catch(e => {\n    // Do something with error\n  });\n```\n\n## AxeBuilder({ client: WebdriverIO.BrowserObject })\n\nConstructor for the AxeBuilder helper. You must pass an instance of WebdriverIO as the first argument.\n\n```js\nconst builder = new AxeBuilder({ client });\n```\n\n### AxeBuilder#include(selector: String)\n\nAdds a CSS selector to the list of elements to include in analysis\n\n```js\nnew AxeBuilder({ client }).include('.results-panel');\n```\n\n### AxeBuilder#exclude(selector: String)\n\nAdd a CSS selector to the list of elements to exclude from analysis\n\n```js\nnew AxeBuilder({ client }).exclude('.another-element');\n```\n\n### AxeBuilder#options(options: [axe.RunOptions](https://github.com/dequelabs/axe-core/blob/develop/doc/API.md#options-parameter))\n\nSpecifies options to be used by `axe.run`. Will override any other configured options. including calls to `AxeBuilder#withRules()` and `AxeBuilder#withTags()`. See [axe-core API documentation](https://github.com/dequelabs/axe-core/blob/master/doc/API.md) for information on its structure.\n\n```js\nnew AxeBuilder({ client }).options({ checks: { 'valid-lang': ['orcish'] } });\n```\n\n### AxeBuilder#withRules(rules: String|Array)\n\nLimits analysis to only those with the specified rule IDs. Accepts a String of a single rule ID or an Array of multiple rule IDs. Subsequent calls to `AxeBuilder#options`, `AxeBuilder#withRules` or `AxeBuilder#withRules` will override specified options.\n\n```js\nnew AxeBuilder({ client }).withRules('html-lang');\n```\n\n```js\nnew AxeBuilder({ client }).withRules(['html-lang', 'image-alt']);\n```\n\n### AxeBuilder#withTags(tags: String|Array)\n\nLimits analysis to only those with the specified rule IDs. Accepts a String of a single tag or an Array of multiple tags. Subsequent calls to `AxeBuilder#options`, `AxeBuilder#withRules` or `AxeBuilder#withRules` will override specified options.\n\n```js\nnew AxeBuilder({ client }).withTags('wcag2a');\n```\n\n```js\nnew AxeBuilder({ client }).withTags(['wcag2a', 'wcag2aa']);\n```\n\n### AxeBuilder#disableRules(rules: String|Array)\n\nSkips verification of the rules provided. Accepts a String of a single rule ID or an Array of multiple rule IDs. Subsequent calls to `AxeBuilder#options`, `AxeBuilder#disableRules` will override specified options.\n\n```js\nnew AxeBuilder({ client }).disableRules('color-contrast');\n```\n\n### AxeBuilder#setLegacyMode(legacyMode: boolean = true)\n\nSet the frame testing method to \"legacy mode\". In this mode, axe will not open a blank page in which to aggregate its results. This can be used in an environment where opening a blank page is causes issues.\n\nWith legacy mode turned on, axe will fall back to its test solution prior to the 4.3 release, but with cross-origin frame testing disabled. The `frame-tested` rule will report which frames were untested.\n\n**Important** Use of `.setLegacyMode()` is a last resort. If you find there is no other solution, please [report this as an issue](https://github.com/dequelabs/axe-core-npm/issues/).\n\n```js\nconst axe = new AxeBuilder({ client }).setLegacyMode();\nconst result = await axe.analyze();\naxe.setLegacyMode(false); // Disables legacy mode\n```\n\n### Shadow DOM support\n\n`@axe-core/webdriverio` is unable to support iframes in shadow DOM elements due to lack of shadow DOM support in [webdriverio](https://webdriver.io/) devtools protocol.\n","readmeFilename":"README.md","_rev":"1-58f06a578666f9ff08721fe6b7228d8f"}