Questions tagged [puppeteer]

Puppeteer, a remarkable Node.js library, boasts an extraordinary high-level API that empowers users to manipulate headless Chrome or Chromium through the powerful DevTools Protocol. Additionally, this versatile tool can be easily customized to leverage the full potential of non-headless Chrome or Chromium.

I am currently facing an issue where the code provided in the Puppeteer documentation is not functioning correctly due to an Un

I followed the code example on the Puppeteer documentation website but unfortunately, it's not working for me. I have Puppeteer 3.0.0 installed via npm. const puppeteer = require('puppeteer'); (async () => { const browser = await puppeteer.launch() ...

Trouble with Mocha async hooks execution?

I keep encountering the issue of receiving 'undefined' for the page in this setup. It appears that none of Mocha's hooks are being executed. I've attempted adding async to the describe at the top level, used done statements, and even tr ...

Having trouble capturing screenshots with PuppeteerJS?

I've encountered an issue while working with Puppeteer to capture screenshots from a provided URL. The code I have below doesn't seem to be functioning properly. It keeps showing the error message: [0] Error: Protocol error (Emulation.setDeviceM ...

What is the reason for the return of undefined with getElementsByClassName() in puppeteer?

Currently, I am utilizing puppeteer to fetch certain elements from a webpage, specifically class items (divs). Although I understand that getElementsByClassName returns a list that needs to be looped through, the function always returns undefined for me, e ...

Adjust puppeteer window dimensions when running in non-headless mode (not viewport)

Is there a way to adjust the browser window size to match the viewport size in Chrome(ium)? When only setting the viewport, the browser can look awkward if it is not running headfully and I want to visually monitor what's happening within the browser ...

Automate Zoom join function with the help of puppeteer

Having trouble joining a Zoom meeting using Puppeteer, my code is not capturing the password field. Can anyone assist? Here is my code snippet: const puppeteer = require("puppeteer-extra"); const StealthPlugin = require("puppeteer-extra-plu ...

What is causing Puppeteer to not wait?

It's my understanding that in the code await Promise.all(...), the sequence of events should be: First console.log is printed 9-second delay occurs Last console.log is printed How can I adjust the timing of the 3rd print statement to be displayed after a ...

Error: Unable to access the 'textContent' property of null - puppeteer

I've been delving into puppeteer lately and I'm quite enjoying it, but I keep encountering a particular issue. Is there a way to prevent this error from happening and retrieve the results of all non-null values? Sometimes this code functions correctly wh ...

Trouble with radio button selection in Pyppeteer, puppeteer, and Angular JS

I am struggling to select the 'fire' option in a radio button within a div element using Pyppeteer. Despite multiple attempts, I have not been successful. Here is the structure of the div with the radio button: <div _ngcontent-xqm-c396="" cla ...

Issues encountered when starting with node.js and puppeteer

As someone who is new to the world of programming, I recently decided to take on a project involving node.js and puppeteer with the goal of scraping a website and saving the data into a .txt file. However, as I embarked on this journey, I quickly realized ...

Having trouble installing Puppeteer with npm due to permission denied errors?

Having trouble installing puppeteer as a project dependency, even after re-installing node. Seeking advice on how to resolve this issue. Currently running Ubuntu 17.10 x64. sudo apt-get purge nodejs; curl -sL https://deb.nodesource.com/setup_8.x | sudo -E ...

Puppeteer: What is the best way to interact with a button that has a specific label?

When trying to click on a button with a specific label, I use the following code: const button = await this.page.$$eval('button', (elms: Element[], label: string) => { const el: Element = elms.find((el: Element) => el.textContent === label) ...

Dealing with data manipulation in the realm of javascript

In the following code snippet, I am iterating through multiple URLs and extracting data (title and content) from each of them. My objective is to store this data for later use on another page, and thus it needs to be accessible using its respective title, ...

Running NodeJS scripts with ElectronJS is not possible

Goal I'm facing a challenge with executing my separate scripts located in the project/api folder. Let's take test.js as an example, where I am exporting it using module.exports. When I run my electron window and create a JavaScript file with a function on ...

Headless Chromium on Raspberry Pi 4 shutting down suddenly due to Puppeteer integration

I'm attempting to automate form submissions using puppeteer on my Raspberry Pi 4 (4GB RAM), and encountering some unusual issues. My script operates flawlessly with headless: false, but when transitioning into headless mode, problems arise. The code ...

Tips for passing a page as an argument in the function parameter of the page.evaluate() method?

I keep running into this issue when I pass the page as an argument: TypeError: Converting circular structure to JSON --> commencing at object with constructor 'BrowserContext' | property '_browser' -> object with constructor 'Browser' ...

retrieve a compilation of all the events linked to a specific DOM element

When using Firefox, you can view events associated with each element in the Inspect Element of developers tools. https://i.stack.imgur.com/bKOK0.png I am looking to create a list of elements and their associated events automatically, ideally using seleniu ...

Hinting the type for the puppeteer page

I am trying to type hint a page variable as a function parameter, but I encountered a compilation error. sync function than_func(page:Page) ^ SyntaxError: Unexpected token: ...

Use Puppeteer and Node.js to repeatedly click a button until it is no longer present, then initiate the next step

Imagine a dynamic web page filled with rows of constantly updated data. The number of rows on the page remains fixed, meaning old rows are replaced and not stored anywhere. To navigate through this page, you need to click on a "load more" button that app ...

When loading a page with Puppeteer using the setContent method, images may not be loaded

Currently, I am experiencing an issue with Puppeteer where it does not load resources that are specified with relative paths (such as background.png in the image src or in CSS url()). When I try to load the content of a local file using setContent(), the o ...

Automating Image Downloads with Puppeteer by Adding Authentication Query String to Image URL

Attempting to save images stored in a web-space account can be challenging. Accessing the private space with credentials and retrieving the image link using Puppeteer works smoothly. However, when the src attribute of the image includes additional authenti ...

Is there a universal method to close all pop-up modals and cookie notifications with Puppeteer?

Is there a universal method to dismiss cookie warnings and modals when capturing a screenshot with puppeteer? ...

Guide to successfully navigating to a webpage using page.link when the link does not have an id, but is designated by a

This is my current code snippet: async function main(){ for(int=0;int<50;int++){ const allLinks = await getLinks(); //console.log(allLinks); const browser = await puppeteer.launch({ headless: true }); const page = await browser.newPa ...

Is there a method to implement retries for inconsistent tests with jest-puppeteer?

Currently, I am struggling with an issue where there is no built-in method to retry flaky tests in Jest. My tech stack includes Jest + TypeScript + Puppeteer. Has anyone else encountered this problem or have any suggestions for possible solutions? I attem ...

Reading a Json file with keys in puppeteer BDD: A Guide

Greetings, I am new to the world of puppeteer. I have successfully created my basic framework and now I am trying to figure out how to read data from .json files. I attempted to use the readFile method in my helper class, but unfortunately, it resulted in ...

Utilize puppeteer and web-vitals in NextJS to retrieve the web performance metrics of a website

I'm currently working on a basic tool in NextJS that uses puppeteer to fetch web vitals data from a given URL. However, I'm facing an issue where the results are not being printed out. What could be causing this problem? const browser = await puppeteer.l ...

When trying to run Puppeteer JavaScript on a page in headless mode, the execution fails

My webpage (secretpage.php) has JavaScript in the HTTP response that sends the value of the userName parameter to my server. <svg/onload=fetch('http://localhost:8080/username='+document.getElementById("userName").innerHTML)> When running C ...

Problem with using puppeteer to interact with a dropdown menu

I have a project in which I am utilizing puppeteer to create a bot that can automatically check for my college homework assignments. The problem I am encountering is that when the bot tries to click on a dropdown menu, it fails and I receive an error messa ...

Puppeteer: implementing wait timeout is crucial to successfully handle Auth0 login process

Recently, I started using puppeteer and encountered some unexpected behavior. It seems that the waitForSelector function does not work properly unless I include a delay before it. Take a look at the following code: const browser = await puppeteer.l ...

"When trying to use puppeteer-extra plugins with webpack in Next.js 13, I encountered the error message "Require cannot be statically

I've been attempting to utilize plugins in puppeteer-cluster, but I'm facing an issue. Interestingly, it works fine without the plugins, but as soon as I add them, things start to go wrong. Below is a snippet of my code: import { NextResponse } from " ...

Puppeteer encounters difficulty when attempting to click on a particular div element within Gmail

I am attempting to click on the three dots in Gmail by following this link: 1 After that, I want to click on the 'mark all as read' option: 2 Clicking on the three dots works without any issues. However, I am encountering difficulty when trying to click ...

I'm having trouble installing puppeteer

I tried running the command npm i --save-dev puppeteer to set up puppeteer for e2e testing. Unfortunately, an error occurred during installation: C:\Users\Mora\Desktop\JS\Testing>npm i --save-dev puppeteer > <a href="/cd ...

Guide on locating an element inside its parent using Puppeteer

When using cypress, I am able to locate child elements within other elements like this: cy.get('div#Login_form).within(() => { cy.get('input[name="human[email]"]').type('John') cy.get('input[name="human[password]"]').type('123456') }) Is there a s ...

Is it better to set the language of Puppeteer's Chromium browser or utilize Apify proxy?

Looking to scrape a website for French results, but the site supports multiple languages. How can I achieve this? Is it best to configure Puppeteer Crawler launch options using args, like so: const pptr = require("puppeteer"); (async () => { const b ...

Difficulties Encountered when Converting HTML to PDF with Puppeteer on AWS Lambda

HTML TO PDF Struggling with the conversion of HTML to PDF using Puppeteer in a Node.js 16 AWS Lambda environment is proving to be quite challenging. Puppeteer's performance seems to vary when deployed on AWS Lambda or serverless setups, despite work ...

The function Page.evaluate() will not run within a Promise sequence

Recently embarked on my journey with Puppeteer. Struggling to extract data from a webpage as the evaluate method seems to be malfunctioning. var Browser var Page var Result puppeteer.launch() .then(function (browser) { console.log('Initialized ...

Launch Puppeteer using customized settings (save PDF rather than using PDF viewer)

I need to configure Chromium in a specific way. The configuration I am seeking can be found here to enable the following option: In order to change the settings for PDF documents to "Download PDF files instead of automatically opening them in Chrome," I ...

A guide to extracting text from HTML elements with puppeteer

This particular query has most likely been asked numerous times, but despite my extensive search, none of the solutions have proven effective in my case. Here is the Div snippet I am currently dealing with: <div class="dataTables_info" id=&qu ...

How can I securely store passwords for web scraping with Puppeteer to ensure maximum safety?

Looking for advice on scraping a website that requires login. The current code saves username and password in a config JSON file, which poses a security risk if the file is accessed by unauthorized individuals. Is there a more secure method, such as encr ...

Puppeteer App Error: An error has been detected on the client side

I am facing an issue using Puppeteer with NEXT.JS while attempting to capture a screenshot. Everything runs smoothly on localhost, but in production, the captured image comes back with the following error message: Application error - a client-side exceptio ...

Comparing Java's iText library with Node's Puppeteer for converting HTML to PDF documents

Is it better to use iText or Puppeteer when generating PDFs from an HTML page and creating a service in either Node.js or Java? Which one offers superior features and performance? Additionally, does Selenium provide the same PDF generation capabilities as ...

Can Puppeteer extract the complete HTML content of a webpage, including any shadow roots?

When using Puppeteer to navigate a webpage, I typically can retrieve the full HTML content as text with this code: let htmlContent = await page.evaluate( () => document.querySelector('body').innerHTML ); However, I am currently faced with a scenario ...

Issues with HTTPS in Puppeteer and VUE JS

I am encountering an issue when running tests from NODE net::ERR_CONNECTION_REFUSED at https://localhost:8087 at navigate (node_modules/puppeteer/src/common/FrameManager.ts:190:13) Test Suites: 2 failed, 2 total Tests: 7 failed, 7 total Snapshots: ...

Encountering difficulties in generating a Docker image for puppeteer

I am currently in the process of building a Docker image using this docker file FROM node:18 # To support major charsets such as Chinese, Japanese, Arabic, Hebrew, Thai, and others, we need to install the latest Chrome dev package and fonts. RUN apt-get u ...

Issue with using puppeteer for testing applications

Having an issue as a beginner in JavaScript, I'm struggling to solve this error. I am fetching data from a website using puppeteer and trying to verify if it's the correct one: const puppeteer = require('puppeteer'); (async () => { const browser = ...

retrieving a property from an ElementHandle

I'm working with Puppeteer within a Node.js module and I need to extract the text property of an HTML element selected by its XPath. Is there a more concise way to achieve this? // Retrieve the element let element = await page.$x(`xpath_expre ...

Strategies for ensuring a promise is fulfilled before moving on to the next iteration in a never-ending for loop in JavaScript

I've been exploring ways to ensure that a promise is resolved before moving on to the next iteration in a for loop. One suggestion was to use the setInterval() function instead of a for loop, but this isn't ideal since it's hard to predict w ...

Puppeteer: Navigate to a specific page number

I'm encountering an issue with a table and page numbers as links, such as: 1, 2, 3, 4 etc… -> each number is a link. Attempted to create a loop to click on different page numbers. On the first iteration, I can reach page 2. However, on the secon ...

Unable to pass the "document" object as an argument to page.exposeFunction in this scenario

Currently, I am utilizing a library called Readability. To utilize the constructor function Readability, a document object must be provided as an argument. Below is the code snippet that I have implemented: await page.exposeFunction('getReadability ...

Tips for locating an element beyond the page source with Puppeteer

My goal is to extract specific information from a webpage by utilizing this code snippet to target an element and retrieve certain values within it: const puppeteer = require('puppeteer'); function run (numberOfPages) { return new Promise(async (reso ...

Puppeteer's waitForSelector function isn't behaving as anticipated

In my code snippet below: const BUSINESS = 'lalala'; await page.waitForSelector('#searchboxinput').then( page.evaluate( (BUSINESS) => { document.querySelector('#searchboxinput').value = BUSINESS }, BUSINESS) ), After setting a wait for ...

The method to extract the followers of an Instagram account using node.js, cheerio, and InstAuto/Puppeteer

Currently, I am attempting to develop a program that generates lists of users who follow specific profiles, and vice versa. Since the Instagram graph API is now inactive, this task has become quite challenging. Despite identifying the correct div element, ...

Is there a possibility for nock to collaborate with puppeteer?

Looking to utilize nock for mocking HTTP requests in puppeteer, but it requires nock to run in the same node process. Are there any solutions or workarounds available for achieving this? Nock offers powerful features that are beneficial for not only end-t ...

If cookies are not set, where does the session data get stored?

Unusual Situation My goal is to access the web platform of Telegram using Node and puppeteer, however I am facing an issue where no cookies are being saved. This includes both in the browser and within puppeteer itself. It seems that Telegram is storing t ...

Challenges with optimizing Puppeteer for performance on Vercel in a Next.js production environment

I am facing an issue when trying to deploy my website to production. I keep getting a 504 status error due to either high memory usage or slow performance. Vercel suggests that the request is taking too long. I am relatively new to using puppeteer and ha ...

Issue: Unable to locate element with the specified selector: #email

const puppeteer = require('puppeteer'); (async () => { const browser = await puppeteer.launch(); const page = await browser.newPage(); await page.goto('https://discord.com/register'); await page.screenshot({path: 'b.png'}); await page.click(' ...

Module 'BrowserFetcher.js' could not be located

After updating all my npm packages, I encountered an issue when trying to run on my local server. The error message reads: Error: Cannot find module './BrowserFetcher.js' This error specifically points to a line in my puppeteer file located at - /Users/Ky ...

Puppeteer and Chromium are ready to go with no need for any configuration

I have a specific HTTP request that I am trying to intercept, but I am encountering issues when chromium is launched through puppeteer. Some flags seem to be causing the requests to not return the expected data. However, everything works fine when I manual ...

Using asynchronous LINQ to filter ElementHandle[] in PuppeteerSharp

Recently, I decided to transition my Selenium Application to Puppeteer Sharp in order to gain a better understanding of this framework. The challenge arises as my application operates on a site for which I do not have access to modify the source code, thus ...

How can I return from cloud functions to Firebase Hosting?

So, here's my idea: to improve the search engine optimization (SEO) of my Single Page Application (SPA), I plan on detecting web crawlers on the server side using headers. If a crawler is detected, I want to render the page with Puppeteer and return it acc ...

Puppeteer works flawlessly on my local machine, but encounters an issue when deployed on Vercel

In my ongoing development of a nextjs project, I encountered the need to utilize puppeteer alongside an API endpoint to load and analyze webpages. The project is deployed and hosted on Vercel. The current implementation that successfully runs locally invo ...

Error encountered with puppeteer: unexpected token "new Promise", causing inability to nest try/catch blocks

Trying to optimize my code by nesting try/catch blocks for smoother execution. Below is the original block of code that was working fine: try { await page.waitFor("#login-form-os-captcha", { timeout: 1500 }); security = true c ...

Instead of watching the video player, the puppeteer automatically downloads the video file

So I have this code snippet below: ;(async () => { const browser = await puppeteer.launch({ args: ['--no-sandbox'], headless: false }) const page = await browser.newPage() await page.goto('https://www.w3schools.com/html/mov_bbb.mp4', ...

Choose a drop-down menu with a div element to be clicked on using Puppeteer

Issue Description: Currently encountering a problem with a dropdown created using material select. The dropdown is populated through an API, and when selected, ul > li's are also populated in the DOM. Approaches Tried: An attempt was made to res ...

Issue encountered - Attempting to provide an object as input parameter to puppeteer function was unsuccessful

Encountering an error when attempting to pass a simple object into an asynchronous function that utilizes puppeteer. The specific error message is: (node:4000) UnhandledPromiseRejectionWarning: Error: Evaluation failed: ReferenceError: userInfo is not def ...

There is no response when keystroke is pressed on the print dialog screen by Puppeteer

I am facing an issue with my puppeteer script that is supposed to loop through a list of pages and print them as PDFs using the print preview dialog instead of Puppeteer's built-in page.pdf function. Everything works fine until it hits this point wher ...

The result of Document.getElementById can show as "undefined" despite the presence of the element

Currently, I am tackling a project that involves extracting information from a website. I have opted to use the 'puppeteer' library in Node.Js for this task. However, I am encountering an issue where Document.getElementById is returning "undefined" when tr ...

Puppeteer with Typescript: Encountering issues during the transpilation process

The issue stems from the fact that I am unable to use Javascript directly due to Firebase Functions Node.JS version lacking support for Async/Await. As a workaround, I have converted the code into Typescript and am currently attempting to transpile it to c ...

Puppeteer encountered an error when trying to evaluate the script: ReferenceError: TABLE_ROW_SELECTOR was not defined

https://i.stack.imgur.com/PJYUf.jpg Recently, I started exploring pupeteer and node while using vscode. My goal is to log into a website and scrape a table. So far, this is what I have: (async () => { const browser = await puppeteer.launch({ headle ...

Unlocking Puppeteer's Ability to Render External JS Pages, Limited to Localhost URLs

I am currently working on setting up server-side rendering for external JavaScript pages using Puppeteer. However, I have run into an issue where when I provide an external URL (not localhost pages), Puppeteer only fetches the source code of the URL withou ...

The process of web scraping specific web page has not yet been completed

Recently, I've been diving into the world of web scraping using node version 8. To get started, I followed this simple command: npm install --save request-promise cheerio puppeteer const rp = require('request-promise'); const url = 'https://www.examples. ...

The HTML element cannot be set within page.evaluate in Node.js Puppeteer

I've run into an issue while using node.js puppeteer, specifically with the page.evaluate method. I'm experiencing difficulties with this part of my code: console.log(response); //This line is valid as it prints a regular string await page.ev ...

Navigating a Frame and Clicking a Link with Puppeteer: A Step-by-Step Guide

I am facing an issue with clicking on an anchor link within a page that is supposed to open a new tab for exporting a PDF. The problem arises because this link is located inside a frame within a frameset structure as shown below: https://i.stack.imgur.com ...

Puppeteer exhibiting unexpected behavior compared to the Developer Console

My goal is to extract the title of the page using Puppeteer from the following URL: Here's the code snippet I am working with: (async () => { const browser = await puppet.launch({ headless: true }); const page = await ...

Puppeteer throwing an error when querying selectors cannot be done (TypeError: selector.startsWith is not a supported function)

I recently installed Puppeteer and ran into an issue when trying to query a selector. I keep receiving a TypeError: selector.startsWith is not a function error. I attempted to resolve the problem by tweaking the core code and adding toString(), but unfort ...