From 8605b7037707addbd98643bb3e454fedb1951917 Mon Sep 17 00:00:00 2001 From: Ralf Vogler Date: Fri, 2 Aug 2024 12:57:37 +0200 Subject: [PATCH] pg: fix internal/external locators, closes #355, waitUntilStable 2s -> 5s --- prime-gaming.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/prime-gaming.js b/prime-gaming.js index eeface0e..b9027121 100644 --- a/prime-gaming.js +++ b/prime-gaming.js @@ -101,6 +101,7 @@ try { let v; while (true) { const v2 = await f(); + console.log('waitUntilStable', v2); if (v == v2) break; v = v2; await act(); @@ -109,7 +110,7 @@ try { const scrollUntilStable = async f => waitUntilStable(f, async () => { await page.keyboard.press('End'); // scroll to bottom to show all games await page.waitForLoadState('networkidle'); // wait for all games to be loaded - await page.waitForTimeout(2000); // TODO networkidle wasn't enough to load all already collected games + await page.waitForTimeout(5000); // TODO networkidle wasn't enough to load all already collected games }); await page.click('button[data-type="Game"]'); @@ -118,8 +119,8 @@ try { await scrollUntilStable(() => games.locator('.item-card__action').count()); console.log('Number of already claimed games (total):', await games.locator('p:has-text("Collected")').count()); // can't use .all() since the list of elements via locator will change after click while we iterate over it - const internal = await games.locator('.item-card__action:has([data-a-target="FGWPOffer"])').elementHandles(); - const external = await games.locator('.item-card__action:has([data-a-target="ExternalOfferClaim"])').all(); + const internal = await games.locator('.item-card__action:has(button[data-a-target="FGWPOffer"])').elementHandles(); + const external = await games.locator('.item-card__action:has(a[data-a-target="FGWPOffer"])').all(); // bottom to top: oldest to newest games internal.reverse(); external.reverse();