Questions tagged [puppeteer]

Puppeteer is a Node.js library which provides a high-level API to control headless Chrome or Chromium over the DevTools Protocol. It can also be configured to use full (non-headless) Chrome or Chromium.

Puppeteer is a Node.js library which provides a high-level API to control headless Chrome or Chromium over the DevTools Protocol. It can also be configured to use full (non-headless) Chrome or Chromium. You can also use Puppeteer with Firefox Nightly (experimental support).


Puppeteer is mostly used for:

  1. Generate screenshots and PDFs of pages.
  2. Crawl an SPA and generate pre-rendered content (i.e. "SSR").
  3. Scrape content from websites.
  4. Automate form submission, UI testing, keyboard input, etc.
  5. Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.
  6. Capture a timeline trace of your site to help diagnose performance issues.

Resources:

Books:

7753 questions
15
votes
1 answer

Puppeteer - checkbox.checked is undefined - why?

I'm using puppeteer and jest to test some stuff on the front end, and I'm having a small issue - I think there is some concept I'm missing. test("Assert that when checkbox isn't checked, dropdown menu is visible", async () => { let checkbox =…
Asool
  • 13,031
  • 7
  • 35
  • 49
15
votes
3 answers

Puppeteer detect when the new tab is opened and get page object

My web app opens a new tab under some conditions. But when I try to get all tabs (await browser.pages()) I get only one back, the initial page. How can I get the new page's object in my code? This happens when you don't create new tab with puppeteer…
Konstantin Bodnia
  • 1,372
  • 3
  • 20
  • 43
15
votes
1 answer

await page.cookies() not returning cookies seen in response header

I am executing a basic puppeteer script that opens a webpage looks at response values and then pulls the cookies. In the example below the response header has the following key values: page.on('response', response => { const req =…
Matthew Essenburg
  • 236
  • 1
  • 2
  • 6
15
votes
1 answer

How to remove "Chrome is being controlled by automated test software"

How can I remove this message by default? I'm using Puppeteer, when chromium launches, it shows this message.
Mehdi Raash
  • 8,721
  • 2
  • 29
  • 42
15
votes
4 answers

Programmatically capturing AJAX traffic with headless Chrome

Chrome officially supports running the browser in headless mode (including programmatic control via the Puppeteer API and/or the CRI library). I've searched through the documentation, but I haven't found how to programmatically capture the AJAX…
Andrei
  • 1,723
  • 1
  • 16
  • 27
14
votes
3 answers

firebase function Puppeteer Could not find Chromium GCP

I have been using GCP for a long time with google cloud, and I wanted to run a cloud function that uses Puppeteer, but unfortunately, I am getting the following error. Unhandled error Error: Could not find Chromium (rev. 1069273). This can occur if…
shaked
  • 561
  • 7
  • 19
14
votes
1 answer

Puppeteer TimeoutError: Navigation timeout of 30000 ms exceeded

I'm developing web screen capture app with Node.js & Google Puppeteer. Now I have to capture 38000 pages and most of the functions are works find but it has errors in some points and I don't know where the errors are coming from. I have two…
writingdeveloper
  • 984
  • 2
  • 21
  • 46
14
votes
1 answer

puppeteer page.evaluate() randomly fails with: Execution context was destroyed, most likely because of a navigation

The following code randomly fails with: Execution context was destroyed, most likely because of navigation. Why is that? Any workarounds? I use puppeteer version 1.19.0 Note: I'm looking for a general solution that allows navigating to both pages…
Misha Moroshko
  • 166,356
  • 226
  • 505
  • 746
14
votes
2 answers

How do you paste text using Puppeteer?

I am trying to write a test (using jest-puppeteer) for an input in my React application that handles autocomplete or copy/pasted strings in a unique way. I was hoping by using Puppeteer, I could paste text into the input and then validate that the…
sandgraham
  • 141
  • 1
  • 1
  • 5
14
votes
2 answers

Streaming a page's audio with puppeteer

Let's assume I go to a page where audio gets played. Is there any way to expose and capture the audio stream coming from this puppeteer page? I don't want to simply save it but instead have access to the stream which I can constantly pipe throughout…
Simon
  • 2,686
  • 2
  • 31
  • 43
14
votes
2 answers

Can I use puppeteer inside chrome extension

I want to build a chrome extension for personal use. The extension will scrape some webpages and it will render some information. So I think puppeteer can help me with that. I understand that I need to run node inside a chrome extension. Is it…
Petran
  • 7,677
  • 22
  • 65
  • 104
14
votes
2 answers

How to use chrome profile in puppeteer

I am unable to use specific profile in Puppeteer. It always open the chrome as a new user. For example: I have 3 profiles for my chrome. Following is the code I am using to open chrome in specific profile: const browser = await puppeteer.launch({ …
nbi
  • 1,276
  • 4
  • 16
  • 26
14
votes
1 answer

Generate PDF with puppeteer without save it

I have an API written with node.js hosted on heroku and my frontend app is written in Vue.js, it is on hostinger. I would like to know if is it possible to generate a PDF file with puppeteer and send it immediately to frontend client without saving…
Felipe Paz
  • 347
  • 1
  • 6
  • 19
14
votes
6 answers

Headless Chrome Node API and Puppeteer installation

Throughout the process of installation chrome headless on a clean ubuntu 18.04 i faced quite a few issues. The setup guide on github is not sufficient for a clean ubuntu 18.04 The following are some errors and answer / solutions to setting up…
CodeGuru
  • 3,645
  • 14
  • 55
  • 99
14
votes
1 answer

How would puppeteer wait for all redirects

I have a puppeteer project which needs to submit a form and then wait for the next page. The problem is that to get to the next page, the site would make around 3-4 redirects and only then will start loading the actual content. It seems Puppeteer is…
Roman
  • 4,443
  • 14
  • 56
  • 81