Skip to content

Commit c8cf736

Browse files
committed
eg: wait for purchaseBtn to have some text, fixes #375
1 parent fef5b97 commit c8cf736

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

epic-games.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ try {
156156
for (const url of urls) {
157157
if (cfg.time) console.time('claim game');
158158
await page.goto(url); // , { waitUntil: 'domcontentloaded' });
159-
const purchaseBtn = page.locator('button[data-testid="purchase-cta-button"]').first();
159+
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
160160
await purchaseBtn.waitFor();
161161
const btnText = (await purchaseBtn.innerText()).toLowerCase(); // barrier to block until page is loaded
162162

0 commit comments

Comments
 (0)