ue: fix undefined price #44
This fix the issue with undefined price. The price wouldn't be defined in the shopping cart unless clicked if it was empty on page load.
This commit is contained in:
parent
9ef9798626
commit
2a3cb4d7e0
1 changed files with 5 additions and 3 deletions
|
|
@ -120,24 +120,26 @@ try {
|
||||||
} else {
|
} else {
|
||||||
await p.locator('.btn .add').click();
|
await p.locator('.btn .add').click();
|
||||||
console.log(' ↳ Added to cart');
|
console.log(' ↳ Added to cart');
|
||||||
|
await page.waitForTimeout(1000);
|
||||||
}
|
}
|
||||||
ids.push(id);
|
ids.push(id);
|
||||||
}
|
}
|
||||||
if (!ids.length) {
|
if (!ids.length) {
|
||||||
console.log('Nothing to claim');
|
console.log('Nothing to claim');
|
||||||
} else {
|
} else {
|
||||||
|
await page.waitForTimeout(1000);
|
||||||
|
console.log('Click shopping cart');
|
||||||
|
await page.locator('.shopping-cart').click();
|
||||||
await page.waitForTimeout(2000);
|
await page.waitForTimeout(2000);
|
||||||
const price = (await page.locator('.shopping-cart .total .price').innerText()).split(' ');
|
const price = (await page.locator('.shopping-cart .total .price').innerText()).split(' ');
|
||||||
console.log('Price: ', price[1], 'instead of', price[0]);
|
console.log('Price: ', price[1], 'instead of', price[0]);
|
||||||
if (price[1] != '0') {
|
if (price[1] != '0' && price[1] != '$0.00') {
|
||||||
const err = 'Price is not 0! Exit! Please <a href="https://github.com/vogler/free-games-claimer/issues/44">report</a>.';
|
const err = 'Price is not 0! Exit! Please <a href="https://github.com/vogler/free-games-claimer/issues/44">report</a>.';
|
||||||
console.error(err);
|
console.error(err);
|
||||||
notify('unrealengine: ' + err);
|
notify('unrealengine: ' + err);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
// await page.pause();
|
// await page.pause();
|
||||||
console.log('Click shopping cart');
|
|
||||||
await page.locator('.shopping-cart').click();
|
|
||||||
// await page.waitForTimeout(2000);
|
// await page.waitForTimeout(2000);
|
||||||
await page.locator('button.checkout').click();
|
await page.locator('button.checkout').click();
|
||||||
console.log('Click checkout');
|
console.log('Click checkout');
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue