Embed the WAVE engine script (typically api.min.js) within the web page (or parent web page) to be tested. The script must be processed within a web page in a rendered browser context/DOM - headless browser contexts, such as Selenium, Chrome Driver, or Puppeteer are supported. Selenium Web Driver files (JavaScript) and Puppeteer scripts are available.
You can scope the evaluation to a particular page element by setting wave.page, for example:
wave.page = document.getElementById("idOfElementToBeTested");
This can allow analysis of a distinct page element. If wave.page
is not set, the entire page document will be evaluated. If wave.page
is set to anything other than the document, WAVE will return errors for things like missing page title, etc. because these don't exist for a non-document element.
Initiate the evaluation with:
wave.init();
This function can be called via the browser Console in DevTools or via a separate script.
If you have a need for the CSS selector values for elements in the results, then use:
wave.init(4);
The numeric value passed with wave.init()
aligns with the reporttype values as explained in the API documentation.
A wave.results
object is created with all of the WAVE data for you to handle.
wave.results.success
- true or false (only false if something in the evaluation entirely fails, such as with a scripting conflict).wave.results.statistics
- number of WAVE items, number of elements within the tested context, and the page title (if present).wave.results.categories
- a large object with WAVE item types, counts, XPaths, CSS selectors (if init(4)
is set), etc. These items generally (though not perfectly) align with the the API specification.If you want to test the same page or page element again (without reloading the page/script), then reset everything before re-initiating the engine with:
wave.engine.fn.resetEngine();
The WAVE testing process will add data-waveid
attributes to most page elements. If desired, these can be removed by calling:
wave.fn.removeWaveIds();
By licensing or testing the WAVE Accessibility Tool stand-alone online web service, API, and/or related systems (hereafter referred to as WAVE), you acknowledge that you have read, understood, and agree to be bound by the WAVE Terms of Use for your license or trial software.