Skip to content

Commit

Permalink
eg: wait for purchaseBtn to have some text, fixes #375
Browse files Browse the repository at this point in the history
  • Loading branch information
vogler committed Aug 31, 2024
1 parent fef5b97 commit c8cf736
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion epic-games.js
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit c8cf736

Please sign in to comment.