From 2a3cb4d7e03c9c827fcb2dca512b676b117e9ec5 Mon Sep 17 00:00:00 2001 From: ndionne <16137051+ndionne@users.noreply.github.com> Date: Fri, 7 Jun 2024 00:28:39 -0400 Subject: [PATCH] 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. --- unrealengine.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/unrealengine.js b/unrealengine.js index e67633e2..4407c64b 100644 --- a/unrealengine.js +++ b/unrealengine.js @@ -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 report.'; 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');