Emilio Platzer
Emilio Platzer

Reputation: 2479

How to hide address bar in puppeteer (with headless false)

I want to launch Chromium with headless false and hide the address bar (and others like menus, tools, etc)

const puppeteer = require('puppeteer');

(async () => {
    console.log('launching');
    const browser = await puppeteer.launch({headless: false});
    const page = await browser.newPage();
    await page.goto('https://stackoverflow.com');
    await page.setViewport({width:400, height:300});
    await page.keyboard.press('F11'); //doesn't work and it is'n exact I want
})();

I get:

I get

I want:

enter image description here

Upvotes: 2

Views: 4348

Answers (1)

Ramiro Ramirez
Ramiro Ramirez

Reputation: 1522

Hi there you can pass any chromium flags through agrs in the options object at browser.lunch(options). You are looking for --kiosk or --app

const browser = await puppeteer.launch({headless: false, args: ['--app']});

The only detail is that kiosk mode will set the window on fullscreen. That may mess with your viewport size and leave a gray area. Here are the docs, and a list of every flag available

Upvotes: 8

Related Questions