Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ue: fix undefined price #44 #331

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions unrealengine.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,24 +120,26 @@ try {
} else {
await p.locator('.btn .add').click();
console.log(' ↳ Added to cart');
await page.waitForTimeout(1000);
}
ids.push(id);
}
if (!ids.length) {
console.log('Nothing to claim');
} else {
await page.waitForTimeout(1000);
console.log('Click shopping cart');
await page.locator('.shopping-cart').click();
await page.waitForTimeout(2000);
const price = (await page.locator('.shopping-cart .total .price').innerText()).split(' ');
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>.';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should maybe print the price here, just so that people see what it is instead and thus can report better issues in the future?

Suggested change
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 ${price[1]} and thus not 0! Exit! Please <a href="https://github.com/vogler/free-games-claimer/issues/44">report</a>.`;

console.error(err);
notify('unrealengine: ' + err);
process.exit(1);
}
// await page.pause();
console.log('Click shopping cart');
await page.locator('.shopping-cart').click();
// await page.waitForTimeout(2000);
await page.locator('button.checkout').click();
console.log('Click checkout');
Expand Down