Skip to content

Commit

Permalink
fix for #46: "This product is currently unavailable in your region"
Browse files Browse the repository at this point in the history
  • Loading branch information
vogler committed Jan 19, 2023
1 parent 351670f commit 4055ec4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion epic-games.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,13 @@ try {
// it then creates an iframe for the purchase
await page.waitForSelector('#webPurchaseContainer iframe'); // TODO needed?
const iframe = page.frameLocator('#webPurchaseContainer iframe');
await iframe.locator('button:has-text("Place Order")').click();
if (await Promise.any([
iframe.locator('button:has-text("Place Order")').click(),
iframe.locator(':has-text("unavailable in your region")').waitFor().then(_ => 'unavailable'),
]) == 'unavailable') { // can't continue loop from the promise
console.error(' This product is unavailable in your region!');
continue;
};

// I Agree button is only shown for EU accounts! https://github.com/vogler/free-games-claimer/pull/7#issuecomment-1038964872
const btnAgree = iframe.locator('button:has-text("I Agree")');
Expand Down

0 comments on commit 4055ec4

Please sign in to comment.