A console-based JSON-RPC 2.0 server for controlling Puppeteer via stdin/stdout.
npm install puppeteer-jsonrpcA console-based JSON-RPC 2.0 server for controlling Puppeteer via stdin/stdout.
``bashInstall globally
npm install -g puppeteer-jsonrpc
Usage
This package provides a JSON-RPC 2.0 interface to control Puppeteer through stdin/stdout, making it easy to automate browser tasks from any language or environment.
`javascript
// Example of sending a command
const command = {
jsonrpc: '2.0',
id: 1,
method: 'goto',
params: {
url: 'https://example.com'
}
};// Write to stdin of the process
process.stdin.write(JSON.stringify(command) + '\n');
`Available Methods
-
goto: Navigate to a URL
- Params: { url: string }-
getConsole: Get console messages from the page
- Params: None-
takeScreenshot: Take a screenshot
- Params: { fullPage?: boolean }-
getAccessibilitySnapshot: Get accessibility snapshot of the page
- Params: None-
clickElement: Click an element identified by accessibility properties
- Params: { name: string, role: string }`MIT
https://jetbrains.team/p/crl/packages/npm/darkmatter/puppeteer-jsonrpc
https://www.npmjs.com/package/puppeteer-jsonrpc