I have a function that contains a nested arrow function. The nested arrow function needs to access the variable attribute
which is always undefined
. Why is that? How can I make e.getAttribute()
access attribute
variable?
this.getAttr = async (locator, attribute) => {
return await page.$eval(locator, e =>
e.getAttribute(attribute)
);
};