Question
How to getProperty in Playwright
I need to get a property from the element. How do I do that in playwright? I can do getAttribute but I don't see an option for getProperty?
2 43
2
Question
I need to get a property from the element. How do I do that in playwright? I can do getAttribute but I don't see an option for getProperty?
Solution
you can use the evaluate method to get a property from an element.
const propertyValue = await page.$eval(selector, (element, propertyName) => {
return (element as any)[propertyName];
}, 'propertyName');