-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
36e0daa
commit bc60ae4
Showing
1 changed file
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import puppeteer from "puppeteer"; | ||
import iterator from "./iterator.js"; | ||
|
||
var docs = []; | ||
iterator(function (srcname, name, variant) { | ||
docs.push(name); | ||
}); | ||
var browser = await puppeteer.launch({ headless: "new" }); | ||
for (var name of docs) { | ||
console.group(name); | ||
var page = await browser.newPage(); | ||
await page.goto(`${import.meta.dirname}/../docs/${name}/${name}.html`, { | ||
waitUntil: "networkidle2", | ||
}); | ||
var elements = await page.$$(process.argv[2]); | ||
for (var elem of elements) { | ||
var elems = process.argv[3] | ||
? await elem.$$("xpath/" + process.argv[3]) | ||
: [elem]; | ||
for (elem of elems) | ||
console.log( | ||
await elem.evaluate((e) => | ||
e.nodeType === Node.ELEMENT_NODE ? e.outerHTML : e.nodeValue, | ||
), | ||
); | ||
} | ||
console.groupEnd(); | ||
} |