1.How can I run the Puppeteer script on the already installed chrome in mac machine. I tried with the following script, not able to run.
2.Is there any way to open the chrome window with particular window size here I am not talking about viewport, I tried with args "--app-shell-host-window-size=1600x1239" -- not working.
Could anyone help me on the above two issues. Thanks in advance for any help
const puppeteer = require('puppeteer');
(async() => {
const browser = await puppeteer.launch({
headless: false,
executablePath: '/Applications/Google Chrome.app/',
args: ["--app-shell-host-window-size=1600x1239"]
});
const page = await browser.newPage();
await page.goto('http://localhost:8282/publisher/login' ,{
waitUntil: 'load'
});
await page.screenshot({path: '../screenshots/cms-local.png'});
//await browser.close();
})();
After Following the Eric Comment and jegadesh answer below, I changed the code like below and Now it is working except one small issue: window is opening in correct size but content in that window are constrained to some other size, see the screenshot below
Working Code:
const browser = await puppeteer.launch({
headless: false,
// executablePath: '/Applications/Google Chrome.app/',
args: ["--window-size=2400,1239"]
});