Skip to content

Commit

Permalink
pasing chrome path
Browse files Browse the repository at this point in the history
  • Loading branch information
psychology50 committed Sep 19, 2023
1 parent ff4c344 commit 258016c
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions util/crawlKakaoLoginPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,24 @@ async function crawlKakaoLoginPage(finalUrl) {
const osPlatform = process.platform
console.log('[INFO] Scraper running on platform: ', osPlatform);

const chromePathWithQuotes = process.env.CHROME_PATH;
const chromePathWithoutQuotes = chromePathWithQuotes.replace(/'/g, '');
console.log("[INFO] pasing chrome path : " + chromePathWithoutQuotes)
console.log("[INFO] process.cwd() : " + process.cwd())

console.log("[INFO] : start puppeteer");
let puppeteer, chromePath;
if (osPlatform === 'darwin') {
puppeteer = await import("puppeteer-core");
console.log("[INFO] : application runs on macOS");
console.log("[INFO] process.cwd() : " + process.cwd())
console.log("[INFO] process.env.CHROME_PATH : " + process.env.CHROME_PATH);
chromePath = path.relative(process.cwd(), process.env.CHROME_PATH);
chromePath = path.relative(process.cwd(), chromePathWithoutQuotes);
} else if (/^win/i.test(osPlatform)) {
puppeteer = await import("puppeteer");
console.log("[INFO] : application runs on Window");
chromePath = path.relative(process.cwd(), process.env.CHROME_PATH);
chromePath = path.relative(process.cwd(), chromePathWithoutQuotes);
}
console.log("[INFO] : Chrome Path : " + chromePath);

console.log("[INFO] : Chrome Relative Path : " + chromePath);
browser = await puppeteer.launch({
headless: "new",
executablePath: chromePath,
Expand Down

0 comments on commit 258016c

Please sign in to comment.