https://github.com/suhaib-mousa/selenium-incognito-test
๐ต๏ธโโ๏ธ A lightweight Node.js tool that opens web pages in Chrome incognito mode using Selenium โ perfect for QA, performance testing, and automation.
https://github.com/suhaib-mousa/selenium-incognito-test
Last synced: about 2 months ago
JSON representation
๐ต๏ธโโ๏ธ A lightweight Node.js tool that opens web pages in Chrome incognito mode using Selenium โ perfect for QA, performance testing, and automation.
- Host: GitHub
- URL: https://github.com/suhaib-mousa/selenium-incognito-test
- Owner: suhaib-mousa
- License: mit
- Created: 2025-03-27T07:44:35.000Z (about 2 months ago)
- Default Branch: main
- Last Pushed: 2025-03-27T07:56:00.000Z (about 2 months ago)
- Last Synced: 2025-03-27T08:37:44.456Z (about 2 months ago)
- Language: JavaScript
- Size: 0 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Security: SECURITY.md
Awesome Lists containing this project
README
# ๐ selenium-incognito-tool
**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---
## ๐ฆ Features
- 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---
## ๐ ๏ธ Setup
### 1. Clone the repo
```bash
git clone https://github.com/yourusername/selenium-incognito-tool.git
cd selenium-incognito-tool
```### 2. Install dependencies
```bash
npm install
```### 3. Ensure Chrome is installed
This tool attempts to auto-detect the Chrome executable path by:1. Checking config.chromePath in your package.json
1. Using the CHROME_PATH environment variable
1. Falling back to system-installed Chrome via chrome-launcher
You can explicitly define Chrome's path in your config or environment if needed.
---
## โ๏ธ Configuration
```json
"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.**### ๐ Screenshot Behavior
| 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 screenshotsIf `"disabled": true`, all screenshots are skipped regardless of the condition or mode.
### ๐ Explanation:
| 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 |---
## ๐ฆ Modes
### ๐งช `mode: "qa"`
- Takes screenshots.
- Best for visual testing or regression checks### โก `mode: "perf"`
- Only measures page load time
- No screenshots or metadata captured
- Fastest and lightest mode---
## โถ๏ธ Run the Tool
```bash
npm start
```The tool will:
- Launch Chrome in incognito mode
- Open your configured URL
- Capture screenshots (if enabled)
- Measure load times
- Save everything into a `report.json`---
## ๐ Output
Example `report.json`:
```json
[
{
"url": "https://example.com",
"status": "success",
"loadTimeMs": 1052,
"screenshot": "run-1.png"
},
{
"url": "https://example.com",
"status": "success",
"loadTimeMs": 990,
"screenshot": null
}
]
```---
## ๐งฉ Use Cases
- 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---
## ๐ชช License
MIT โ free to use, modify, and share.
---
## ๐ Contributing
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 casesIssues and discussions are also welcome!
---
Made with ๐ง and โ by [suhaib-mousa](https://github.com/suhaib-mousa)