selenium-incognito-tool is a lightweight and developer-friendly browser automation tool that opens a specified URL in Google Chrome's incognito mode using Selenium WebDriver.
It supports two powerful modes:
- π§ͺ QA Mode β capture screenshots for visual testing
- β‘ Performance Mode β measure page load time with zero UI overhead
- Runs Chrome in incognito mode for clean, cache-free sessions
- Supports headless mode for speed and CI compatibility
- Flexible screenshot control: odd/even/every-N runs
- Auto-generates detailed JSON reports
- Easy to configure via
package.json - Pure Node.js β no extra CLI tools or GUIs required
git clone https://github.com/yourusername/selenium-incognito-tool.git
cd selenium-incognito-toolnpm installThis tool attempts to auto-detect the Chrome executable path by:
-
Checking config.chromePath in your package.json
-
Using the CHROME_PATH environment variable
-
Falling back to system-installed Chrome via chrome-launcher
You can explicitly define Chrome's path in your config or environment if needed.
"config": {
"url": "https://example.com",
"times": 5,
"delay": 1000,
"headless": true,
"mode": "qa",
"chromePath": "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe", // optional
"screenshot": {
"pattern": "run-{index}.png",
"condition": "every-2",
"disabled": false
}
}π‘ The chromePath field is optional. If omitted, the tool will try to detect Chrome automatically.
| Mode | Condition Respected | Notes |
|---|---|---|
"qa" |
β Yes | Screenshots follow condition rules (odd, even, every-3, etc.) |
"perf" |
β No | Screenshots are always skipped in performance mode |
"seo" |
Not yet supported | Reserved for future use |
Conditions supported:
"all"β every run"odd"β 1st, 3rd, 5th..."even"β 2nd, 4th, 6th..."every-N"β every Nth run (e.g.every-3)"none"β skip all screenshots
If "disabled": true, all screenshots are skipped regardless of the condition or mode.
| Key | Type | Description |
|---|---|---|
url |
string | URL to open in browser |
times |
number | Number of runs (sessions) |
delay |
number (ms) | Wait time before closing each session |
headless |
boolean | Run Chrome in headless mode |
mode |
"qa" / "perf" |
Operation mode |
chromePath |
string (Optional) |
Path to Chrome binary |
screenshot.pattern |
string | Filename format (use {index} as placeholder) |
screenshot.condition |
"all", "odd", "even", "every-N" |
When to take screenshots |
screenshot.disabled |
boolean | Completely disables screenshots |
- Takes screenshots.
- Best for visual testing or regression checks
- Only measures page load time
- No screenshots or metadata captured
- Fastest and lightest mode
npm startThe tool will:
- Launch Chrome in incognito mode
- Open your configured URL
- Capture screenshots (if enabled)
- Measure load times
- Save everything into a
report.json
Example report.json:
[
{
"url": "https://example.com",
"status": "success",
"loadTimeMs": 1052,
"screenshot": "run-1.png"
},
{
"url": "https://example.com",
"status": "success",
"loadTimeMs": 990,
"screenshot": null
}
]- QA teams testing landing pages and UI snapshots
- Performance testing on clean browser sessions
- Scheduled automation for checking page behavior
- Debugging redirects, CDNs, or A/B tests
- Smoke testing before deployment
MIT β free to use, modify, and share.
Got a cool idea or want to improve it?
Fork the repo, make your changes, and submit a pull request.
We welcome:
- Bug fixes
- Feature enhancements
- Documentation improvements
- New ideas for testing or automation use cases
Issues and discussions are also welcome!
Made with π§ and β by suhaib-mousa