Adds support for classes

This commit is contained in:
Thomas Forgione 2023-02-17 11:19:03 +01:00
parent a36e88d15e
commit 9a66c7c491
1 changed files with 6 additions and 0 deletions

View File

@ -85,6 +85,8 @@ async function main() {
for (let element of elements) { for (let element of elements) {
let box = await element.boundingBox(); let box = await element.boundingBox();
let classNameAttr = await element.getProperty('className');
let className = await classNameAttr.jsonValue();
// Scale the bounding box // Scale the bounding box
box.x /= size.width; box.x /= size.width;
@ -95,6 +97,10 @@ async function main() {
// Give the selector as type // Give the selector as type
box.type = selector; box.type = selector;
if (className !== "") {
box.class = className;
}
info.push(box); info.push(box);
} }