I’m using playwright and the smartui extension to automatically take screenshots, like here:
I have 2 problems:
- How long do I have to wait to fetch the result with “smartui.fetchScreenshotStatus”? Because if I do this immediately after saving it (with await, I do wait until it has finished), I will get an error that the screenshot could not be found.
- When I wait about 10-20 seconds and do get a result, the misMatchPercentage is missing in the data. Do I have to wait even longer? Have I missed something else?
This way I only get basic data I already know:
const screenshotName = siteName + "screenshot" + i;
await page.evaluate((_) => {
},
`lambdatest_action: ${JSON.stringify({action: "smartui.takeScreenshot", arguments: {fullPage: true, screenshotName}})}`); // Add a relevant screenshot name here
console.log("Waiting like 20 seconds...");
await new Promise((resolve) => setTimeout(resolve, 20000))
const data = await page.evaluate(_ => {
}, `lambdatest_action: ${JSON.stringify({action: 'smartui.fetchScreenshotStatus', arguments: {screenshotName}})}`)
console.log("Result from Comparison:", JSON.parse(data));