File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -80,6 +80,43 @@ recent (or slightly less than recent) versions of Safari.
8080
8181See the <code >Contrib/PhantomJS/HTMLCS_Run.js</code > file for more information.
8282
83+ #### Headless Google Chrome via Puppeteer
84+
85+ [ Puppeteer] ( https://developers.google.com/web/tools/puppeteer/get-started ) offers an
86+ easy way to interact with the page via Google Chrome.
87+
88+ This example assumes that there is the latest version of Google Chrome installed,
89+ hence only the ` puppeteer-core ` will be needed:
90+
91+ ``` sh
92+ npm i puppeteer-core
93+ ```
94+
95+ The test script assumes a recent version of Node.js to be available.
96+
97+ ``` javascript
98+ const puppeteer = require (' puppeteer-core' );
99+
100+ (async () => {
101+ const browser = await puppeteer .launch ({
102+ executablePath: ' Google Chrome binary location'
103+ });
104+ const page = await browser .newPage ();
105+ page .on (' console' , msg => console .log (msg .text ()));
106+
107+ await page .goto (' web site URL' );
108+
109+ await page .addScriptTag ({
110+ path: ' build/HTMLCS.js'
111+ });
112+ await page .evaluate (function () {
113+ HTMLCS_RUNNER .run (' WCAG2AA' );
114+ });
115+
116+ await browser .close ();
117+ })();
118+ ```
119+
83120#### Node & JSDom
84121
85122HTML_CodeSniffer requires a dom to run, however, it is possible to run it entirely
You can’t perform that action at this time.
0 commit comments