I'm attempting to use puppeteer to take a screenshot, and to do this I want to get the coordinates of an element. I'm trying to use this code to do that:
clip = await page.evaluate(() => {
global.log('print progress a');
const uiElement = document.querySelector('#printout');
global.log('print progress b');
return uiElement ? uiElement.getBoundingClientRect() : defaultCoordinates;
});
But as far as I can tell this code isn't even being used; the logs are not written at all and it always uses the defaultCoordinates
Can anyone see any reasons why this would not be evaluated?