From c8cf7362fa2ff92386eee4dc847784d95d7f5195 Mon Sep 17 00:00:00 2001 From: Ralf Vogler Date: Sun, 1 Sep 2024 01:20:45 +0200 Subject: [PATCH] eg: wait for purchaseBtn to have some text, fixes #375 --- epic-games.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epic-games.js b/epic-games.js index d8784f8..f853380 100644 --- a/epic-games.js +++ b/epic-games.js @@ -156,7 +156,7 @@ try { for (const url of urls) { if (cfg.time) console.time('claim game'); await page.goto(url); // , { waitUntil: 'domcontentloaded' }); - const purchaseBtn = page.locator('button[data-testid="purchase-cta-button"]').first(); + const purchaseBtn = page.locator('button[data-testid="purchase-cta-button"] >> :has-text("e"), :has-text("i")').first(); // when loading, the button text is empty -> need to wait for some text {'get', 'in library', 'requires base game'} -> just wait for e or i to not be too specific; :text-matches("\w+") somehow didn't work - https://github.com/vogler/free-games-claimer/issues/375 await purchaseBtn.waitFor(); const btnText = (await purchaseBtn.innerText()).toLowerCase(); // barrier to block until page is loaded