Full support for classes
This commit is contained in:
parent
9a66c7c491
commit
b1c3d6a630
10
index.js
10
index.js
|
@ -80,12 +80,18 @@ async function main() {
|
|||
let shouldCreateSpan = query !== "ul" && query !== "ol" && query != "img";
|
||||
|
||||
// Query the considered element
|
||||
let parents = await page.$$(query);
|
||||
let elements = await page.$$(query + (shouldCreateSpan ? ' > *:first-child' : ''));
|
||||
|
||||
for (let element of elements) {
|
||||
for (let index = 0; index < elements.length; index ++) {
|
||||
|
||||
let parent = parents[index];
|
||||
let element = elements[index];
|
||||
|
||||
let box = await element.boundingBox();
|
||||
let classNameAttr = await element.getProperty('className');
|
||||
|
||||
let classElement = shouldCreateSpan ? parent : element;
|
||||
let classNameAttr = await classElement.getProperty('className');
|
||||
let className = await classNameAttr.jsonValue();
|
||||
|
||||
// Scale the bounding box
|
||||
|
|
Loading…
Reference in New Issue