From de78e010e4ffa4447fed0656179e840d0fd31c7c Mon Sep 17 00:00:00 2001 From: Dung Nguyen <> Date: Sun, 27 Feb 2022 11:17:15 +0700 Subject: [PATCH] fix --- index.js | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/index.js b/index.js index a17e960..00d03cf 100644 --- a/index.js +++ b/index.js @@ -56,7 +56,7 @@ const CONFIG = { }; puppeteer - .launch({ headless: true, args: ["--no-sandbox"] }) + .launch({ headless: false, args: ["--no-sandbox"] }) .then(async (browser) => { const page = await browser.newPage(); await page.setViewport({ width: 1366, height: 768 }); @@ -95,6 +95,7 @@ puppeteer if (data.includes("BO_PRICE")) { const isDisableBtn = await page.evaluate(() => { + if (!document) return false; const btnCheck = document.querySelector( "#betAmount > div:nth-child(5) > div > div:nth-child(1) > button" ); @@ -174,20 +175,6 @@ puppeteer } }) - function isEnterOrderFn() { - let result = false; - page.evaluate(() => { - const btnCheck = document.querySelector( - "#betAmount > div:nth-child(5) > div > div:nth-child(1) > button" - ); - if (btnCheck) { - const isDisableBtn = btnCheck.hasAttribute("disabled"); - result = !isDisableBtn; - } - result = false; - }); - return result; - } // Vào lệnh: type - buy/sell async function enterOrderFn(type, countMoney, myTelegramID) { await page.type(`input#InputNumber`, String(countMoney), { @@ -549,7 +536,7 @@ Bạn sẽ vào lệnh ở phiên tiếp theo(${currentEnterOrderCheck.sessionID } } - CONFIG.enterOrderList = CONFIG.enterOrderList.filter((e) => e.sessionID !== sessionID - 1); + CONFIG.enterOrderList.splice(indEnterOrder, 1); } }