From 3d25737e0fef6462504b925c2a42a16e7f3d43ec Mon Sep 17 00:00:00 2001 From: Ralf Vogler Date: Tue, 27 May 2025 23:36:15 +0200 Subject: [PATCH] ae: fix Collect not being clicked before it exits --- aliexpress.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/aliexpress.js b/aliexpress.js index 1f8cc2e..ec4e09c 100644 --- a/aliexpress.js +++ b/aliexpress.js @@ -88,7 +88,8 @@ const urls = { const coins = async () => { const collectBtn = page.locator('div:has-text("Collect")').first(); const moreBtn = page.locator('div:has-text("Earn more coins")').first(); - await Promise.any([collectBtn.click(), moreBtn.waitFor()]); + // await Promise.any([collectBtn.click(), moreBtn.waitFor()]); // this somehow did not make it click the collect button... try moreBtn.isVisible()? + await collectBtn.click().catch(_ => moreBtn.waitFor()); // TODO change this since it's going to delay by timeout if already collected console.log(await page.locator('.marquee-content:has-text(" coins")').first().innerText()); const n = (await page.locator('.marquee-item:has-text(" coins")').first().innerText()).replace(' coins', ''); console.log('Coins:', n);