Chrome Headless is the headless mode of Chrome and Chromium used for automation, testing, and CI scenarios. Use this tag for questions related to the usage of Chrome Headless and the DevTools protocol.
Questions tagged [google-chrome-headless]
1156 questions
131
votes
17 answers
How to configure ChromeDriver to initiate Chrome browser in Headless mode through Selenium?
I'm working on a python script to web-scrape and have gone down the path of using Chromedriver as one of the packages. I would like this to operate in the background without any pop-up windows. I'm using the option 'headless' on chromedriver and it…

Maz
- 1,589
- 2
- 10
- 13
119
votes
11 answers
Running Selenium with Headless Chrome Webdriver
I'm trying some stuff out with selenium, and I really want my script to run quickly.
I thought that running my script with headless Chrome would make it faster.
First, is that assumption correct, or does it not matter if I run my script with a…

Rhynden
- 1,297
- 2
- 8
- 8
116
votes
15 answers
Puppeteer wait until page is completely loaded
I am working on creating PDF from web page.
The application on which I am working is single page application.
I tried many options and suggestion on https://github.com/GoogleChrome/puppeteer/issues/1412
But it is not working
const browser =…

n.sharvarish
- 1,423
- 4
- 13
- 13
82
votes
12 answers
Downloading with chrome headless and selenium
I'm using python-selenium and Chrome 59 and trying to automate a simple download sequence. When I launch the browser normally, the download works, but when I do so in headless mode, the download doesn't work.
# Headless implementation
from selenium…

TheChetan
- 4,440
- 3
- 32
- 41
69
votes
10 answers
Is it possible to run Google Chrome in headless mode with extensions?
I cannot use my currently installed extensions in Google Chrome using headless mode. Is there any way to enable them?
An easy way to check if the extensions work is by adding, for example, the "Comic Sans Everything" extension.
So Google looks like…

pau.moreno
- 4,407
- 3
- 35
- 37
60
votes
8 answers
Puppeteer - Protocol error (Page.navigate): Target closed
As you can see with the sample code below, I'm using Puppeteer with a cluster of workers in Node to run multiple requests of websites screenshots by a given URL:
const cluster = require('cluster');
const express = require('express');
const…

LioRz
- 835
- 1
- 9
- 17
60
votes
3 answers
Puppeteer: How to submit a form?
Using puppeteer, how could you programmatically submit a form? So far I've been able to do this using page.click('.input[type="submit"]') if the form actually includes a submit input. But for forms that don't include a submit input, focusing on the…

docta_faustus
- 2,383
- 4
- 30
- 47
58
votes
7 answers
How do I use Headless Chrome in Chrome 60 on Windows 10?
I've been looking at the following article about Headless Chrome:
https://developers.google.com/web/updates/2017/04/headless-chrome
I just upgraded Chrome on Windows 10 to version 60, but when I run either of the following commands from the command…

HartleySan
- 7,404
- 14
- 66
- 119
55
votes
4 answers
How to modify the first pageNumber or execute JS in header or footer template with Chrome DevTools Protocol's printToPDF
I'm using Headless Chrome to print out PDF files by using the printToPDF CDP method. If we set the displayHeaderFooter parameter to true, then we can set specific page header and footer by using the parameters headerTemplate and footerTemplate. The…

user9179380
- 591
- 3
- 5
50
votes
9 answers
Puppeteer: How to handle multiple tabs?
Scenario: Web form for developer app registration with two part workflow.
Page 1: Fill out developer app details and click on button to create Application ID, which opens, in a new tab...
Page 2: The App ID page. I need to copy the App ID from this…

nwxdev
- 4,194
- 3
- 16
- 22
46
votes
6 answers
additional options in Chrome headless print-to-pdf
I need help one more time. I am trying to print a page to pdf using headless feature of the chrome. However, header and footer is present in the pdf. I found that this option as been implemented in…

user2580925
- 811
- 2
- 8
- 14
44
votes
2 answers
google-chrome Failed to move to new namespace
Im trying to run google-chrome --headless inside a docker container as a non-root user to execute some tests.
Everytime Im trying to start it, it throws following error:
google-chrome --headless
Failed to move to new namespace: PID namespaces…

novak100
- 1,259
- 1
- 12
- 20
44
votes
1 answer
Make Chrome Headless to Wait for Ajax Before Printing to PDF
I'm trying to use chrome headless to print my webpage to a PDF file.
The PDf file is with no data, because the headless chrome is printing it before the ajax commands finish.
Any idea on how I can get it to wait?
Here's the command I currently…

Gil Shamgar
- 578
- 1
- 6
- 12
36
votes
3 answers
Puppeteer page.evaluate querySelectorAll return empty objects
I am trying out Puppeteer. This is a sample code that you can run on: https://try-puppeteer.appspot.com/
The problem is this code is returning an array of empty…

Abdullah Alsigar
- 1,236
- 1
- 12
- 16
36
votes
6 answers
How can I change paper size in headless Chrome --print-to-pdf
I am using headless Chrome to export html documents to pdf
google-chrome --headless --disable-gpu --print-to-pdf='output_path' 'url'
How can I change paper size in generated pdf?
I have control on both Chrome parameters and html.
I always get US…

Crazy Yoghurt
- 2,365
- 2
- 26
- 37