# ccf-playwright-browser

Adopt this skill: https://proskills.md/skills/other/foxmale007-ccf-playwright-browser

Page: https://proskills.md/skills/other/foxmale007-ccf-playwright-browser
This document is the public skill bundle for that page. It contains SKILL.md and every helper file the catalog carries. No login is required.

## File: SKILL.md
size: 2277
upstream: https://github.com/foxmale007/ccf-playwright-browser/blob/HEAD/SKILL.md

````text
---
name: ccf-playwright-browser
description: Stealth browser automation using Playwright with snapshot-based environment restoration. Use when browser automation needs anti-bot evasion, snapshot or cookie restoration, proxy support, or human-like navigation behavior.
metadata: {"openclaw":{"emoji":"🎭","os":["linux","darwin","win32"],"requires":{"bins":["node","npx"]},"install":[{"id":"npm-playwright","kind":"npm","package":"playwright","bins":["playwright"],"label":"Install Playwright"}]}}
---

# Playwright Stealth Automation Skill

This skill launches a **stealth Playwright browser** with anti-bot protections and snapshot-based environment restoration.

It bypasses many common detection systems including:

- Cloudflare

- Datadome

- Akamai

- PerimeterX

Capabilities:

- browser snapshot restore

- cookies restore

- localStorage/sessionStorage restore

- navigator fingerprint spoofing

- WebGL fingerprint spoof

- Canvas fingerprint noise

- Audio fingerprint noise

- human mouse movement

- human scrolling

- header spoofing

- proxy support

---

# Installation

```

npm install -g playwright

npx playwright install chromium

```

Linux:

```

sudo npx playwright install-deps chromium

```

---

# Snapshot Input

The browser environment can be restored using a **snapshot JSON**.

Priority order:

```

1 user provided snapshot JSON

2 scripts/snapshot.json

```

If the user provides a JSON snapshot block, it should be passed to the script.

---

# Launching Browser

Agents should initialize the browser by executing:

```

node scripts/init_browser.js

```

If the user provides snapshot JSON, pass it via stdin:

```

node scripts/init_browser.js <<EOF

{snapshot json}

EOF

```

---

# Automation Strategy

Agents should simulate human behavior:

- random delays

- mouse movement

- natural scrolling

- avoid deterministic timing

Example actions after browser launch:

- navigate to a page

- scroll gradually

- move mouse randomly

- wait between actions

---

# Proxy Example

```

HTTP_PROXY=http://127.0.0.1:7890 node scripts/init_browser.js

```

---

# References

Playwright Docs  

https://playwright.dev

API Reference  

https://playwright.dev/docs/api

````

## File: README.md
upstream: https://github.com/foxmale007/ccf-playwright-browser/blob/HEAD/README.md

````text
# 🎭 ccf-playwright-browser

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Playwright](https://img.shields.io/badge/Powered%20by-Playwright-green.svg)](https://playwright.dev/)
[![Chrome Extension](https://img.shields.io/badge/Chrome%20Extension-Available-blue.svg)](chrome-extension/)

> 🚀 Playwright AI skills combined with a Chrome extension for seamless browser automation with real user sessions

**English** | [🌐 中文](README_cn.md)

---

## ✨ Features

| Feature | Description |
|---------|-------------|
| 🔐 **Session Injection** | Easily inject your own login sessions for OpenClaw automation |
| 🛡️ **Anti-Detection** | Bypass browser detection with advanced stealth techniques |
| 🍪 **Cookie Extraction** | Capture all cookies including HttpOnly cookies |
| 🌐 **Environment Mimicry** | Replicate real browser environment (UA, locale, timezone, screen size) |
| 📦 **One-Click Export** | Chrome extension for instant session extraction |

---

## 📁 Project Structure

```
ccf-playwright-browser/
├── 📂 chrome-extension/     # Chrome extension for session extraction
│   ├── manifest.json        # Extension manifest
│   ├── popup.html           # Extension popup UI
│   ├── popup.js             # Popup logic
│   ├── background.js        # Service worker for data collection
│   └── README.md            # Extension documentation
├── 📂 scripts/              # Playwright automation scripts
│   ├── init_browser.js      # Browser initialization with stealth
│   └── snapshot.json        # Sample snapshot file
├── LICENSE                  # MIT License
└── README.md                # This file
```

---

## 🚀 Quick Start

### 1️⃣ Install Chrome Extension

1. Open Chrome and navigate to `chrome://extensions`
2. Enable **"Developer mode"** in the top right corner
3. Click **"Load unpacked"** and select the `chrome-extension` directory
4. The extension icon will appear in your toolbar ✅

### 2️⃣ Extract Login State

1. Navigate to any website you want to extract login state from
2. Log in to your account (if required) 🔐
3. Click the extension icon in the toolbar
4. Click **"Extract Login State"** to collect:
   - 🍪 Cookies (including HttpOnly)
   - 🌍 Browser environment
   - 📋 Request headers
   - 💾 Storage data
5. Click **"Copy to Clipboard"** 📋

### 3️⃣ Use with Playwright

```javascript
// Save the copied JSON to snapshot.json
// Then run the initialization script
node scripts/init_browser.js scripts/snapshot.json
```

---

## 💡 Usage Example

After copying the JSON data from the extension, use it like this:

```
请使用下面的 browser snapshot 启用 ccf-playwright-browser，
并加载 cookies、headers、storage 和浏览器环境。
然后打开网页 `https://<your-website-url>/`，3秒后截图：

<copied json data>
```

---

## 🔧 Technical Details

### 🛡️ Stealth Features

The `init_browser.js` script includes advanced anti-detection measures:

- ✅ Removes `navigator.webdriver` flag
- ✅ Masks automation indicators
- ✅ Spoofs WebGL renderer info
- ✅ Randomizes canvas fingerprint
- ✅ Modifies audio context
- ✅ Custom permission queries
- ✅ Font checking bypass

### 🍪 Cookie Handling

- Automatically normalizes cookie expiration timestamps
- Supports all cookie attributes (Secure, HttpOnly, SameSite)
- Handles oversized values gracefully

### 🌐 Environment Capture

| Data Type | Captured Info |
|-----------|---------------|
| **Navigator** | User-Agent, Platform, Language, Hardware specs |
| **Screen** | Width, Height, Color depth, Available space |
| **Intl** | Locale, Timezone, Number format |
| **Storage** | localStorage, sessionStorage |
| **Headers** | Observed request headers |

---

## 📋 Requirements

- 🟢 Node.js 16+
- 🟢 Playwright
- 🟢 Chrome Browser (for extension)

---

## 📦 Installation

```bash
# Clone the repository
git clone https://github.com/yourusername/ccf-playwright-browser.git

# Install Playwright
npm install playwright

# Install Playwright browsers
npx playwright install chromium
```

---

## 🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

---

## 📄 License

This project is licensed under the [MIT License](LICENSE) - see the LICENSE file for details.

---

## 🙏 Acknowledgments

- [Playwright](https://playwright.dev/) - Web testing and automation framework
- Chrome Extensions API - For browser data access

---

<div align="center">

**⭐ Star this repo if you find it helpful! ⭐**

Made with ❤️ for the automation community

</div>
````
