Reputation: 199
I want to hover on some element, let say document.getElementById("abc")
and find its hover computed style.
How should I do it in Node.js using Puppeteer?
Upvotes: 2
Views: 4586
Reputation: 29037
You can use the following solution to iterate and hover over certain elements to obtain the computed style:
const elements = await page.$$('.abc');
const data = [];
for (let i = 0; i < elements.length; i++) {
await elements[i].hover();
data.push(await page.evaluate(element => window.getComputedStyle(element), elements[i]));
}
console.log(data);
Upvotes: 7