npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

accessibility-testing-package

v1.0.3

Published

Npm package for accessibility testing for both playwright and selenium

Downloads

30

Readme

accessibility-testing-package

Installation

Install this package using npm i accessibility-testing-package

Why I created this package?

The primary packages, namely axe-core and axe-html-reporter were already in place. However, there are two separate wrappers available for playwright and Selenium. In this package, I have tried to create a consolidated package for both of these popular testing tools along with creating necessary wrappers for convenience.

NOTE

It is a good idea to import tslib for the files where the methods of this package will be used.

The methods

The following are the methods exposed for this package

CoreAccessibilityMethods

To access the methods for CoreAccessibilityMethods, we need to first import it in our typescript file:
import {CoreAccessibilityMethods} from 'accessibility-testing-package'

  • PageTestPlaywright : This method scans the entire content of the current page for any accessibility issues. It takes the page variable as a parameter.

Example: await CoreAccessibilityMethods.PageTestPlaywright(page)

  • PageTestPlaywrightWithOptions : This method scans the entire content of the current page for any accessibility issues pertaining to particular tags/rules. It takes the page variable and an object specifying the tags/rules as parameters.

Example:

await CoreAccessibilityMethods.PageTestPlaywrightWithOptions(page,{ 
    type:'tags',
    values:['wcag131']
    })
  • ElementTestPlaywright: This method scans only the specified element of the current page for any accessibility issues. This takes the page and the elementHandle of the element under test. It is independent of how the elementHandle is obtained (by locator/selector etc).

Example:

const selectorElementHandle=await page.locator('#searchDropdownBox').elementHandle()
        const results=await CoreAccessibilityMethods.ElementTestPlaywright(page,selectorElementHandle)
  • ElementTestPlaywrightWithOptions: This method scans only the specified element of the current page for any accessibility issues pertaining to certain rules/tags. This takes the page, the elementHandle of the element under test and the object specifying the tags/rules as parameters. It is independent of how the elementHandle is obtained (by locator/selector etc).

Example:

const locatorElementHandle=await page.getByRole('searchbox', { name: 'Search Amazon' }).elementHandle()

        const results=await CoreAccessibilityMethods.ElementTestPlaywrightWithOptions(page,locatorElementHandle,{
            type:'tags',
            values:['best-practice']
        })
  • PageTestSelenium: This method scans the entire current webpage for any accessibility issues. It takes the driver (WebDriver) as a parameter.
    Example: const results=await CoreAccessibilityMethods.PageTestSelenium(driver)

  • PageTestSeleniumWithOptions: This method scans the entire current webpage for any accessibility issues subject to specified tags/rules. It takes the driver (WebDriver) and the object specifying the tags/rules as parameters.

Example:

const results=await CoreAccessibilityMethods.PageTestSeleniumWithOptions(driver,{
            type:'tags',
            values:['wcag131']
        })
  • ElementTestSelenium: This method scans a specific element for accessibility issues. It takes the driver (WebDriver) and the element (WebElement) as parameters.

Example: const results=await CoreAccessibilityMethods.ElementTestSelenium(driver,await driver.findElement(By.css(elementId)))

  • ElementTestSeleniumWithOptions: This method scans a specific element for accessibility issues subject to specified tags/rules. It takes the driver (WebDriver), the element (WebElement) and the object specifying the tags/rules as parameters.
const results=await CoreAccessibilityMethods.ElementTestSeleniumWithOptions(driver,await driver.findElement(By.xpath(elementXpath)),{
            type:'tags',
            values:['section508']
        })

ReportMethods

To access the methods for CoreAccessibilityMethods, we need to first import it in our typescript file:
import {ReportMethods} from 'accessibility-testing-package'

  • CreateHtmlReport: This method creates a html axe report at a specified path with a specified name. This method takes the folder path where the report would be generated, the name of the html report file to be generated and the results (AxeResults) as parameters.
    Example: ReportMethods.CreateHtmlReport('./Reports','AxeHtmlReport.html',results)
  • GetHtmlReportString: This method creates and returns the html string of the axe html report. It takes only the results (AxeResults) as a parameter.

Feedback requested!

Looking forward to community feedback for enhancements/ideas/issue fixes.

Contact me

Email: [email protected]
LinkedIn: Anuran Bhattacharya