const fs = require('fs');
[...]
const path = `results/screenshots/${projectname}/${date}`;
try {
await page.screenshot({ path: `${path}/SiteAdded.png` });
} catch(err) {
fs.mkdirSync(path);
await page.screenshot({ path: `${path}/SiteAdded.png` });
}