But this gives me an error and doesn’t work at all. I think there’s something wrong with my syntax but I can’t figure out what. How can I combine both the no-sandbox argument and the headless false option in the same launch configuration? Any help would be great.
you’re missing a comma after the args array! should be {args: ['--no-sandbox'], headless: false} - the comma separates the two options in the object. common mistake, happens to everyone.
You’re getting a syntax error because your object formatting is wrong. When you pass multiple options to puppeteer.launch(), you need commas between each property:
I’ve used this setup for months in my testing environment when sandbox restrictions mess things up. Just make sure you’ve got proper JavaScript object syntax with commas between properties. You can throw in other debugging options like slowMo: 100 or devtools: true the same way if you need them.
I’ve run puppeteer in similar restricted environments where no-sandbox is required. When you combine these options, the browser opens normally but behaves a bit differently than sandboxed mode. Just heads up - no-sandbox disables Chrome’s security sandbox, so be careful what sites you test against when debugging with the visible window.