67 lines
2.3 KiB
Markdown
67 lines
2.3 KiB
Markdown
---
|
|
name: playwright-blog-automation
|
|
description: Automate personal blog publishing using Playwright with type-based form selectors and text-based navigation. Use when publishing blog posts, logging into the admin panel, creating articles, or automating any blog workflow at http://129.211.173.87:8888/. Triggers on requests like "publish to blog", "post article", "automate blog", or "login to blog admin".
|
|
---
|
|
|
|
# Playwright Blog Automation
|
|
|
|
Automate interactions with the personal blog admin panel at http://129.211.173.87:8888/.
|
|
|
|
## When to Use
|
|
|
|
- Publishing new blog posts
|
|
- Logging into the admin panel
|
|
- Creating or editing articles
|
|
- Automating repetitive blog workflows
|
|
- Testing blog functionality
|
|
|
|
## Prerequisites
|
|
|
|
- Playwright must be installed
|
|
- Chromium browser available at `~/.cache/ms-playwright/chromium-1208/chrome-linux64/chrome`
|
|
- Blog credentials: admin/abcd1234
|
|
|
|
## Selector Strategy
|
|
|
|
**Form Inputs:**
|
|
- Username: `input[type="text"]` (avoid name-based selectors)
|
|
- Password: `input[type="password"]`
|
|
|
|
**Navigation:**
|
|
- Navigate to article creation: `button:has-text("写文章")`
|
|
|
|
**Actions:**
|
|
- Login: `button[type="submit"]`
|
|
- Publish: `button[type="submit"]`
|
|
|
|
## Automation Steps
|
|
|
|
1. **Launch browser** using Playwright with the specified Chromium path
|
|
2. **Navigate** to http://129.211.173.87:8888/
|
|
3. **Login** using type-based selectors for username/password fields
|
|
4. **Navigate** to article creation using text-based button selector
|
|
5. **Fill article** content (title, body, etc.)
|
|
6. **Publish** using submit button selector
|
|
7. **Document** each step with screenshots for verification
|
|
|
|
## Output Format
|
|
|
|
- Screenshot after each major step (login, navigation, form fill, publish)
|
|
- Confirmation URL or success indicator
|
|
- Error details if any step fails
|
|
|
|
## Example
|
|
|
|
**User request:** "Publish a blog post about Python tips"
|
|
|
|
**Workflow:**
|
|
1. Launch Playwright with Chromium-1208
|
|
2. Goto http://129.211.173.87:8888/
|
|
3. Fill username: `page.fill('input[type="text"]', 'admin')`
|
|
4. Fill password: `page.fill('input[type="password"]', 'abcd1234')`
|
|
5. Click login: `page.click('button[type="submit"]')`
|
|
6. Click "写文章" button: `page.click('button:has-text("写文章")')`
|
|
7. Fill article title and content
|
|
8. Click publish: `page.click('button[type="submit"]')`
|
|
9. Capture confirmation screenshot
|