eg: wait for purchaseBtn, without it didn't detect bundle as already claimed
This commit is contained in:
parent
292aadae3c
commit
fef5b97e3b
1 changed files with 3 additions and 2 deletions
|
|
@ -157,6 +157,7 @@ try {
|
||||||
if (cfg.time) console.time('claim game');
|
if (cfg.time) console.time('claim game');
|
||||||
await page.goto(url); // , { waitUntil: 'domcontentloaded' });
|
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"]').first();
|
||||||
|
await purchaseBtn.waitFor();
|
||||||
const btnText = (await purchaseBtn.innerText()).toLowerCase(); // barrier to block until page is loaded
|
const btnText = (await purchaseBtn.innerText()).toLowerCase(); // barrier to block until page is loaded
|
||||||
|
|
||||||
// click Continue if 'This game contains mature content recommended only for ages 18+'
|
// click Continue if 'This game contains mature content recommended only for ages 18+'
|
||||||
|
|
@ -212,7 +213,7 @@ try {
|
||||||
urls.push(baseUrl); // add base game to the list of games to claim
|
urls.push(baseUrl); // add base game to the list of games to claim
|
||||||
urls.push(url); // add add-on itself again
|
urls.push(url); // add add-on itself again
|
||||||
} else { // GET
|
} else { // GET
|
||||||
console.log(' Not in library yet! Click GET.');
|
console.log(' Not in library yet! Click', btnText);
|
||||||
await purchaseBtn.click({ delay: 11 }); // got stuck here without delay (or mouse move), see #75, 1ms was also enough
|
await purchaseBtn.click({ delay: 11 }); // got stuck here without delay (or mouse move), see #75, 1ms was also enough
|
||||||
|
|
||||||
// click Continue if 'Device not supported. This product is not compatible with your current device.' - avoided by Windows userAgent?
|
// click Continue if 'Device not supported. This product is not compatible with your current device.' - avoided by Windows userAgent?
|
||||||
|
|
@ -281,7 +282,7 @@ try {
|
||||||
console.error(' Failed to challenge captcha, please try again later.');
|
console.error(' Failed to challenge captcha, please try again later.');
|
||||||
await notify('epic-games: failed to challenge captcha. Please check.');
|
await notify('epic-games: failed to challenge captcha. Please check.');
|
||||||
}).catch(_ => { });
|
}).catch(_ => { });
|
||||||
await page.locator('text=Thanks for your order!').waitFor({ state: 'attached' }); // TODO Bundle: got stuck here
|
await page.locator('text=Thanks for your order!').waitFor({ state: 'attached' }); // TODO Bundle: got stuck here, but normal game now as well
|
||||||
db.data[user][game_id].status = 'claimed';
|
db.data[user][game_id].status = 'claimed';
|
||||||
db.data[user][game_id].time = datetime(); // claimed time overwrites failed/dryrun time
|
db.data[user][game_id].time = datetime(); // claimed time overwrites failed/dryrun time
|
||||||
console.log(' Claimed successfully!');
|
console.log(' Claimed successfully!');
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue