clickIfExists only if isVisible, closes #20

This commit is contained in:
Ralf Vogler 2022-08-28 20:35:02 +01:00
parent 08da100646
commit 6f2271168d

View file

@ -39,7 +39,7 @@ const page = context.pages()[0];
console.debug('userAgent:', await page.evaluate(() => navigator.userAgent));
const clickIfExists = async selector => {
if (await page.locator(selector).count() > 0)
if (await page.locator(selector).count() > 0 && await page.locator(selector).isVisible())
await page.click(selector);
};