deanmao/node-chimera logo

deanmao/node-chimera

Free

A new kind of headless webkit integration for nodejs; a great alternative to phantomjs.

FreeFree tier
Type
Open Source

About deanmao/node-chimera

Chimera is a headless webkit integration for Node.js that provides an alternative to PhantomJS. It creates isolated browser instances directly within the Node.js environment, eliminating the need for an external process. Key capabilities include custom user agents, cookie management, library injection (e.g., jQuery), image disabling, and sandboxed JavaScript execution. Installation is via npm, and it currently offers prebuilt binaries for 64-bit macOS and Linux. The perform method allows loading a URL, passing JSON-serializable variables, executing scripts inside the page, and returning control to Node.js via a callback. Chimera is suitable for web scraping, automated testing, and server-side page interaction.

Key Features

Headless webkit integration for Node.js
Runs inside Node.js environment without external process
Isolated browser instances with separate sessions and cookies
Custom user agent support
Library injection via libraryCode option (e.g., jQuery)
Cookie persistence and reloading
Option to disable images for faster loading
Sandboxed JavaScript execution with callbacks to Node.js
URL history tracking per instance

Pros & Cons

Pros
  • Direct Node.js integration eliminates need for external process
  • Easy installation via npm with prebuilt binaries
  • Customizable browser instances with isolated state
  • Supports injecting JavaScript libraries for enhanced page control
Cons
  • Limited platform support – only prebuilt binaries for 64-bit macOS and Linux
  • May require manual compilation for other operating systems or architectures
  • Sandboxed environment restricts passing Node.js references directly; only JSON-serializable data allowed
  • Documentation is minimal, primarily a single README with basic examples

Best For

Web scraping JavaScript-heavy websitesAutomated testing of web applicationsServer-side rendering and page interactionProgrammatic form submission and DOM manipulation

FAQ

How do I install Chimera?
Install via npm: npm install chimera. The postinstall script downloads the native binary for supported platforms (64-bit macOS and Linux).
What platforms are supported?
Currently, prebuilt binaries are available for 64-bit macOS (darwin) and 64-bit Linux. For other platforms, you may need to compile from source.
How do I create a browser instance and load a page?
Instantiate a new Chimera object, then call the perform method with an options object containing url, locals, run function, and callback function. The run function executes inside the page, and callback returns control to Node.js.
Can I inject JavaScript libraries like jQuery into loaded pages?
Yes, use the libraryCode option when creating a Chimera instance to inject JavaScript code (e.g., the contents of jQuery.js) into every page loaded by that instance.
Does Chimera support cookies?
Yes, each browser instance has its own in-memory cookie database. You can also pass cookies as a string to the constructor to restore a previous session.