Запускаю браузер с помощью playwright, потом хочу сделать скриншот элемента с помощью html2canvas. В примере пишу только все связанное с html2canvas и его передачей в браузер playwright
const { default: html2canvas } = require("html2canvas");
const screenshot = await page.evaluate((html2canvas) => {
var x = html2canvas(document.getElementById(`id("fear-and-greed-dial")`)).then(function(canvas) {
canvas.toDataURL();
document.getElementById("screen").appendChild(my_screen);
var imgUrl = canvas.toDataURL ("image / png");
return imgUrl;
} );
return x;
});
Вылетает с ошибкой html2canvas is not a function. Но как передать функцию?