I have a project that sometimes will throw an error when try to delete an object.
I would like to catch that error and click on the OK button to close it.
Here is what works for me.
const element = page.getByRole("button", { name: "OK" }); if (await element.isVisible()) { await element.click(); }
Top comments (0)