-
Dear Alfa developers,
From my understanding the Input of the Audit.of() has to be a Page-object and can't be the document DOM-Element itself correct? Is there an alfa-package that can maybe convert DOM-elements in a way that they can be audited? I have been trying basic examples with for example the alfa-scraper and packages like Browserify to bundle the code. But these rely on e.g. Puppeteer which obviously didn't work in the browser directly (or shouldn't be necessary because the website data is already there). Thank you for your help in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
Hi @TobiasG95, We do have a browser extension that run on all major browsers (incl Chrome and Safari) and does not launch puppeteer either… So it is definitely possible 😄 Quickly looking into it, it seems that the trick is to serialize I'll check whether we can open source that serialisation function… |
Beta Was this translation helpful? Give feedback.
-
Checking further (this is part of the code I'm not really using 😅 ), it seems that Does import { Native, Node } from "@siteimprove/alfa-dom"
const alfaDocument = Node.from(Native.fromNode(window.document)) work? |
Beta Was this translation helpful? Give feedback.
Checking further (this is part of the code I'm not really using 😅 ), it seems that
alfa-dom/Native.fromNode
should do the trick to turn the node into an Alfa JSON that can be fed toNode.from
Does
work?
(this is essentially what is done in
Puppeteer.toNode
with an extra trick around the JSHandle)