Socket
Socket
Sign inDemoInstall

node-red-puppeteer

Package Overview
Dependencies
118
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    node-red-puppeteer

NodeRED nodes to control a headless chrome with puppeteer


Version published
Maintainers
1
Created

Changelog

Source

1.0.1 - 2023-07-26

Updated README

Readme

Source

node-red-puppeteer

These node-red nodes expose puppeteer's API used for controlling Chrome/Chromium over the DevTools Protocol

GroupNode NameDetailed information
BrowserLaunch

Launch Chrome browser

Inputs

Timeout: number
Maximum time in milliseconds to wait for the browser instance to start. Defaults to 30000 (30 seconds). Pass 0 to disable timeout.
Slow Motion: number
Slows down Puppeteer operations by the specified amount of milliseconds. Useful so that you can see what is going on.
Hide Chrome: boolean
Whether to run browser in headless mode. Defaults to false, it will show Chrome when devtools option is true.
Debug Port: number
Specify custom debugging port. It will connect to existing Chrome if port specified. Pass 0 to discover a random port. Defaults to 0.
Show Devtools: boolean
Whether to auto-open a DevTools panel for each tab. If this option is true , the Hide Chrome option will be set false.

Outputs

msg.puppeteer.browser: object
The puppeteer browser object
msg.puppeteer.page: object
The puppeteer page object

Details

Must launch Chrome browser before run any puppeteer actions

BrowserNew PageThis node creates/opens new page(tab) in existing chromium instance or rather puppeteer.browser object
BrowserClose BrowserThis node closes chromium browser instance provided with puppeteer.browser object
PageClick

Click on Chrome

Inputs

Selector: string
selectorto search for element to click. If there are multiple elements satisfying the selector, the first will be clicked.
Button: string
Slows down Puppeteer operations by the specified amount of milliseconds. Useful so that you can see what is going on.<"left"|"right"|"middle"> Defaults to left.
Click Count: number
Whether to run browser in  headless mode. Defaults to false, it will show Chrome when devtools option is true. Defaults to 1. See UIEvent.detail.
Delay: number
Specify custom debugging port. Pass 0  to discover a random port. Defaults to 0. Time to wait between mousedown and mouseup in milliseconds. Defaults to 0.

Details

This node fetches an element with selector, scrolls it into view if needed, and then uses page.mouse to click in the center of the element. If there's no element matching selector, the node throws an error.

PageClose

Close first chromium page(tab)

Details

This node closes first chromium page(tab) provided with puppeteer.browser object

PageContent

Get content from page

Details

This node gets page's content from puppeteer.page object

PageDelete CookiesThis node deletes all the cookies from the passed puppeteer.page object
PageDownload

Dowload a file

Inputs

Selector: string
selector to search for element to click. If there are multiple elements satisfying the selector, the first will be clicked.
Button: string
Slows down Puppeteer operations by the specified amount of milliseconds. Useful so that you can see what is going on.<"left"|"right"|"middle"> Defaults to left.
Click Count: number
Delay: number
Download path: string
Specify custom download path. Leave the field blank for default download path. Defaults to user's default browser download path.
File name: string
Specify custom file name. Leave the field blank for default file name. Please note that in order for this to work this node needs to be followed by the rename node(in storage section). Defaults to default file name.

Details

This method fetches an element with selector, scrolls it into view if needed, and then uses page.mouse to click in the center of the element. If there's no element matching selector, the method throws an error. The main difference between this and click node is that with this node you can specify download path and file name. But, in order the custom filename to work, this node must have download path and file name specified and be followed by a rename node(in storage section)where the old file path should be set to msg.old and the new file path should be set to msg.new

PageFocus

Focus on element

Details

This node fetches an element with selector and puts it in focus. If there's no element matching selector, the node throws an error.

PageGet

Get property value from element

Details

This node fetches a specified property value from element with specified selector . If there's no element matching the selector, the node throws an error.

PageGet Cookies
This node retrieves all cookies using the passed page object as input (msg.puppeteer.page). This node otputs list of cookies in msg.payload property. Each object contains the following properties:
  • name: string
  • value: string
  • domain: string
  • path: string
  • expires: number
  • size: number
  • httpOnly: boolean
  • secure: boolean
  • session: boolean
  • sameSite: string
  • sameParty: boolean
  • sourceScheme: string
  • sourcePort: number
PageGo to

Chrome page navigation

Inputs

URL: string
URL to navigate page to. The URL should include scheme, e.g. https://
Wait Until: string
When to consider navigation succeeded. Given an array of event strings, navigation is considered to be successful after all events have been fired. Events can be either:
load : consider navigation to be finished when the load event is fired.
domcontentloaded : consider navigation to be finished when the DOMContentLoaded event is fired.
networkidle0 : consider navigation to be finished when there are no more than 0 network connections for at least 500 ms.
networkidle2 : consider navigation to be finished when there are no more than 2 network connections for at least 500 ms.
PageScreenshot

Capture Screen

Inputs

Capture Full Page: boolean
When true, takes a screenshot of the full scrollable page. Defaults to false.

Outputs

msg.payload: Buffer
buffer with captured screenshot.

Details

Browser screenshot, require focus / active to browser

PageSet

Set value to input field

Details

This node fetches an element with selector and if the element is input field it changes its value to the value specified in the Value field. If there's no element matching selector, the node throws an error.

PageSet Cookies
This node sets the cookies on the current page object. The input page object should be passed as msg.puppeteer.page. The cookies should be a list of cookie objects where each one has the following properties and they should be passed in as msg.payload, or if directly into the input field it should be a valid JSON list:
  • name: string|required
  • value: string|required
  • domain: string|optional,
    Default value: '{domain from page object}'
  • path: string|optional,
    Default value: '/'
  • expires: number|optional,
    Default value: -1
  • size: number|optional,
    Default value: {cookie size}
  • httpOnly: boolean|optional,
    Default value: false
  • secure: boolean|optional,
    Default value: true
  • session: boolean|optional,
    Default value: true
  • sameSite: string|optional,
    Default value: undefined
  • sameParty: boolean|optional,
    Default value: false
  • sourceScheme: string|optional,
    Default value: 'Secure'
  • sourcePort: number|optional,
    Default value: 443
PageUpload

Upload file to specified selector

Details

This node uploads a file(or more accurately specified filePath) specified with Upload File to the element speicified with the selector if it exists.

PageWait for

Wait for selector

Details

This node awaits for element specified with selector. If the wait timeouts/element doesn't exist, this node throws an error

KeyboardPress

Keyboard Press

Details

This node presses the keyboard key specified in Key input field.

KeyboardType

Keyboard Type

Details

This node types the text specified in the Text input using the puppeteer.page.keyboard.type function.

StorageRename

Rename file

Inputs

Old file path: string
New file path: string

Details

This node renames the file from old file path to the new file path, or essetially it moves it from one location to another if that is how the paths are specified.

Install these nodes using the following command or directly via node-red dashboard
npm install node-red-puppeteer

Keywords

FAQs

Last updated on 17 Dec 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc