eg: simpler check if game is unavailable in region
This commit is contained in:
parent
4055ec44c7
commit
c09da8eec6
1 changed files with 4 additions and 5 deletions
|
|
@ -145,13 +145,12 @@ try {
|
||||||
// it then creates an iframe for the purchase
|
// it then creates an iframe for the purchase
|
||||||
await page.waitForSelector('#webPurchaseContainer iframe'); // TODO needed?
|
await page.waitForSelector('#webPurchaseContainer iframe'); // TODO needed?
|
||||||
const iframe = page.frameLocator('#webPurchaseContainer iframe');
|
const iframe = page.frameLocator('#webPurchaseContainer iframe');
|
||||||
if (await Promise.any([
|
// skip game if unavailable in region, https://github.com/vogler/free-games-claimer/issues/46 TODO check games for account's region
|
||||||
iframe.locator('button:has-text("Place Order")').click(),
|
if (await iframe.locator(':has-text("unavailable in your region")').count() > 0) {
|
||||||
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!');
|
console.error(' This product is unavailable in your region!');
|
||||||
continue;
|
continue;
|
||||||
};
|
}
|
||||||
|
await iframe.locator('button:has-text("Place Order")').click();
|
||||||
|
|
||||||
// I Agree button is only shown for EU accounts! https://github.com/vogler/free-games-claimer/pull/7#issuecomment-1038964872
|
// 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")');
|
const btnAgree = iframe.locator('button:has-text("I Agree")');
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue