From 8e236b746a882c5da299ee12e64fbeb2c10e0a6e Mon Sep 17 00:00:00 2001 From: "syed.bilal" Date: Fri, 23 Jan 2026 11:24:42 +0500 Subject: [PATCH] changed browser open page logic --- sync-fi-invoices.js | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/sync-fi-invoices.js b/sync-fi-invoices.js index 1709d7a..5f15024 100644 --- a/sync-fi-invoices.js +++ b/sync-fi-invoices.js @@ -22,12 +22,26 @@ const utils = require("./utils"); const environment = process.env["ENVIRONMENT"]; - const browser = await puppeteer.launch({ - headless: "new", - args: ["--no-sandbox", "--disable-setuid-sandbox"] - }); - - const page = await browser.newPage(); + // launch browser and open page + const chromeProfilePath = path.resolve( + __dirname, + config[environment]["chrome_profile_path"] + ); + const browser = await puppeteer.launch( + utils.getBrowserConfig(chromeProfilePath, environment) + ); + const page = await browser.newPage(); + await page.setViewport({ + width: 1600, + height: 900, + }); + + // Inject CSS to show the cursor + await page.evaluate(() => { + const style = document.createElement("style"); + style.innerHTML = "* { cursor: auto !important; }"; + document.head.appendChild(style); + }); await page.goto( config[environment].psw_url, -- 2.40.1