# segmentio/nightmare

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/segmentio-nightmare).**

19,775 stars · 1,064 forks · JavaScript

## Links

- GitHub: https://github.com/segmentio/nightmare
- Homepage: https://open.segment.com
- awesome-repositories: https://awesome-repositories.com/repository/segmentio-nightmare.md

## Description

Nightmare is an Electron-based browser automation library and headless browser controller. It provides the infrastructure to programmatically navigate web pages, interact with DOM elements, and execute JavaScript within a background browser instance.

The project distinguishes itself by integrating a full Chromium instance within an Electron shell, allowing for the management of browser sessions, network proxy settings, and persistent storage partitions. It enables the capture of page states as PNG screenshots, PDF documents, or HTML files.

The tool covers a broad range of capabilities including automated web scraping, visual testing, and synthetic user monitoring. It includes utilities for cookie management, network traffic configuration via custom HTTP headers, and the ability to extend the browser's functionality through custom actions and plugins.

## Tags

### Development Tools & Productivity

- [Browser Automation](https://awesome-repositories.com/f/development-tools-productivity/browser-automation.md) — Provides a framework for controlling headless browsers to mimic user behaviors like typing and clicking. ([source](https://github.com/segmentio/nightmare#readme))

### Web Development

- [Headless Browser Controllers](https://awesome-repositories.com/f/web-development/headless-browser-controllers.md) — Provides a control layer for managing headless browser instances to programmatically navigate and interact with web pages.
- [Browser Automation](https://awesome-repositories.com/f/web-development/browser-automation.md) — Controls web browsers programmatically to mimic human behavior, navigate pages, and interact with elements.
- [Electron Browser Hosting](https://awesome-repositories.com/f/web-development/electron-browser-hosting.md) — Integrates a full Chromium instance within an Electron shell to provide native browser control.
- [Chrome DevTools Protocols](https://awesome-repositories.com/f/web-development/web-automation-scraping/browser-control-protocols/chrome-devtools-protocols.md) — Implements the Chrome DevTools Protocol to send commands and receive events from the browser engine.
- [Web Scraping](https://awesome-repositories.com/f/web-development/web-automation-scraping/web-scraping-automation/web-scraping.md) — Extracts structured data from websites by executing JavaScript and capturing HTML source.
- [Browser Cookie Management](https://awesome-repositories.com/f/web-development/browser-integration-utilities/browser-apis/browser-storage/browser-cookie-management.md) — Provides utilities to read, set, and clear cookies for specific domains to handle session state. ([source](https://github.com/segmentio/nightmare#readme))
- [Script Injections](https://awesome-repositories.com/f/web-development/custom-page-frameworks/page-content-injections/script-injections.md) — Executes custom JavaScript within the browser context to extract data and manipulate the page DOM.
- [Browser Session Managers](https://awesome-repositories.com/f/web-development/web-automation-scraping/web-scraping-automation/browser-automation/browser-session-managers.md) — Manages cookies, local storage, and network proxy settings to maintain persistent authenticated sessions.
- [Web Page Retrievers](https://awesome-repositories.com/f/web-development/web-page-retrievers.md) — Runs custom JavaScript within the page context to retrieve structured information and verify elements. ([source](https://github.com/segmentio/nightmare#readme))

### Data & Databases

- [Browser Storage Persistence](https://awesome-repositories.com/f/data-databases/state-persistence/browser-storage-persistence.md) — Configures storage partitions to maintain cookies and local storage across different browser instances. ([source](https://github.com/segmentio/nightmare#readme))

### Graphics & Multimedia

- [Web Page Screenshot and PDF Tools](https://awesome-repositories.com/f/graphics-multimedia/web-page-media-generation/web-page-screenshot-and-pdf-tools.md) — Saves the current browser view as PNG screenshots, PDF documents, or HTML files for archiving. ([source](https://github.com/segmentio/nightmare#readme))

### Software Engineering & Architecture

- [Promise-Based Flow Wrappers](https://awesome-repositories.com/f/software-engineering-architecture/api-wrappers/promise-based-flow-wrappers.md) — Wraps asynchronous browser communications in a promise-based flow to simulate a sequential execution model.

### System Administration & Monitoring

- [Synthetic User Monitoring](https://awesome-repositories.com/f/system-administration-monitoring/synthetic-user-monitoring.md) — Simulates user journeys and listens for JavaScript errors or console logs to ensure website stability.

### Testing & Quality Assurance

- [Visual Regression Testing](https://awesome-repositories.com/f/testing-quality-assurance/visual-regression-testing.md) — Captures screenshots and PDFs of web pages to verify layouts and detect visual regressions.

### Part of an Awesome List

- [Browser Automation](https://awesome-repositories.com/f/awesome-lists/devtools/browser-automation.md) — High-level browser automation library based on Electron.
- [Testing Frameworks](https://awesome-repositories.com/f/awesome-lists/devtools/testing-frameworks.md) — High-level browser automation library for end-to-end testing.
