puppeteer-jsonrpc
v1.0.5
Published
A console-based JSON-RPC 2.0 server for controlling Puppeteer via stdin/stdout.
Downloads
3,774
Readme
puppeteer-jsonrpc
A console-based JSON-RPC 2.0 server for controlling Puppeteer via stdin/stdout.
Installation
# Install globally
npm install -g puppeteer-jsonrpc
# Install Chrome for Puppeteer (needed before first use)
npx [email protected] browsers install chrome
# Or run directly with npx
npx puppeteer-jsonrpcUsage
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.
// 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 }
- Params:
getConsole: Get console messages from the page- Params: None
takeScreenshot: Take a screenshot- Params:
{ fullPage?: boolean }
- Params:
getAccessibilitySnapshot: Get accessibility snapshot of the page- Params: None
clickElement: Click an element identified by accessibility properties- Params:
{ name: string, role: string }
- Params:
License
MIT
Publishing
https://jetbrains.team/p/crl/packages/npm/darkmatter/puppeteer-jsonrpc https://www.npmjs.com/package/puppeteer-jsonrpc
