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.
Use wave.init(3) to include XPath values or wave.init(4) to include CSS selectors. Calling wave.init() gives counts and item details. The locator options match the reporttype values 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 - an object with WAVE item types, counts, and any requested XPath or CSS selector values. 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();
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.