From 6f2271168dc70304ed47f0fad63ae67a412b7889 Mon Sep 17 00:00:00 2001 From: Ralf Vogler Date: Sun, 28 Aug 2022 20:35:02 +0100 Subject: [PATCH] `clickIfExists` only if `isVisible`, closes #20 --- prime-gaming.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prime-gaming.js b/prime-gaming.js index 8a87a17..baa2b46 100644 --- a/prime-gaming.js +++ b/prime-gaming.js @@ -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); };