How nightwatchjs/nightwatch-inspector works
Nightwatch Inspector is a Chrome developer tool for finding CSS selectors on a webpage and, in Nightwatch debug mode, trying Nightwatch commands from its DevTools panel. The principal workflow is to enable Explore Mode, inspect or click a page element, generate a selector, and review, copy, or highlight it in the selector history. A separate command-testing branch connects the panel to the local Nightwatch server. The graph includes documented features whose implementation was not sampled; dashed, uncited links mark relationships that the available excerpts do not verify.
Main entry points: content/index.js Page interactions · websocket.js Server connection · js/index.js Panel coordination · background.js Message routing
Components 17
Page inspection
- Page interactions
src/content/index.js - Selector generation
src/content/generateSelector.js - Selector tooltip
src/content/tooltip.js - Element highlighting
src/content/index.js
Extension bridge
- Message routing
src/background.js - DevTools panel entry
src/nightwatchInspector.js
Inspector panel
- Panel coordination
src/panel/js/index.js - Explore Mode
src/panel/js/exploreMode.js - Selector history
src/panel/js/selectorHistory.js - Selector copying
src/panel/js/selectorHistory.js - Inspector interface
src/panel/index.html
Command testing
- Command suggestions
src/panel/js/suggestion.js - Command execution UI
src/panel/js/tryNightwatchCommands.js - Server connection
src/panel/js/websocket.js
Other components
- Developer
- Inspected webpage
- Nightwatch server
Connections 20
- Developer → DevTools panel entry: opens inspector
README.md - DevTools panel entry → Inspector interface: creates panel
src/nightwatchInspector.js - Developer → Explore Mode: starts exploration
README.md - Explore Mode → Message routing: requests mode
- Message routing → Page interactions: routes messages
src/background.js - Inspected webpage → Page interactions: provides interactions
src/content/index.js - Page interactions → Selector generation: generates selector
src/content/index.js - Page interactions → Selector tooltip: updates tooltip
- Page interactions → Message routing: sends selector
src/content/index.js - Selector history → Page interactions: requests highlight
src/panel/js/selectorHistory.js - Developer → Selector copying: copies selector
README.md - Developer → Command execution UI: tries command
README.md - Command execution UI → Server connection: submits command
- Server connection → Nightwatch server: connects over WebSocket
src/panel/js/websocket.js - Nightwatch server → Server connection: returns results
src/panel/js/websocket.js - Server connection → Command suggestions: provides command list
- Server connection → Selector history: records commands
src/panel/js/websocket.js - Panel coordination → Selector history: coordinates history
- Panel coordination → Explore Mode: coordinates exploration
- Panel coordination → Command execution UI: coordinates commands