I’m trying to run Puppeteer with specific settings but I’m hitting a wall. I need to disable the sandbox for my project to work. At the same time, I want to see what’s happening during execution for debugging purposes.
Here’s what I’ve attempted so far:
const browser = await puppeteer.launch({
args: ['--no-sandbox'],
headless: false
});
Unfortunately, this code isn’t doing the trick. The browser still launches in headless mode. I’m not sure if I’m formatting the options correctly or if there’s another way to achieve this.
Does anyone know the proper way to configure Puppeteer to run without sandbox and in non-headless mode simultaneously? Any help would be much appreciated!
I’ve been working with Puppeteer for a while now, and I’ve found that sometimes the browser settings can be a bit finicky. In your case, I’d suggest trying this approach:
const browser = await puppeteer.launch({
args: ['--no-sandbox', '--disable-gpu'],
headless: false,
defaultViewport: null,
executablePath: '/path/to/chrome'
});
The ‘–disable-gpu’ argument can sometimes help with rendering issues. Setting ‘defaultViewport’ to null allows the browser to use its default size, which can be helpful for debugging. Also, explicitly specifying the ‘executablePath’ to your Chrome installation might resolve any conflicts with system-wide settings.
If you’re still having trouble, check your Chrome version and make sure it’s compatible with your Puppeteer version. Sometimes, updating both can solve unexpected behavior. Hope this helps!
hey dude, i had the same prob. try this:
const browser = await puppeteer.launch({
args: ['--no-sandbox'],
headless: false,
ignoreDefaultArgs: ['--disable-extensions']
});
the ‘ignoreDefaultArgs’ thing helped me. also make sure ur using the latest puppeteer version. good luck!
I’ve encountered similar issues when configuring Puppeteer. The solution that worked for me was slightly different from what you’ve tried. Here’s the code I used:
const browser = await puppeteer.launch({
args: ['--no-sandbox', '--disable-setuid-sandbox'],
headless: false,
defaultViewport: null
});
The key differences are adding ‘–disable-setuid-sandbox’ to the args array and setting defaultViewport to null. This combination should launch Puppeteer without sandbox restrictions and in non-headless mode.
Also, ensure you’re using a recent version of Puppeteer, as older versions might have different behavior. If you’re still having trouble, double-check your Puppeteer installation and Node.js version compatibility.