Merge pull request 'changed browser open page logic' (#2) from psw-crawler into main

Reviewed-on: http://git.utopiadeals.com:8080/saif.haq/temu-labels-crawler/pulls/2
main
saif.haq 2026-01-23 06:26:17 +00:00
commit cff43606fd
1 changed files with 20 additions and 6 deletions

View File

@ -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"]
});
// 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,
});
const page = await browser.newPage();
// 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,