Add commands for dealing with cache and site data, cookies, etc

This commit is contained in:
Josh at WLTechBlog
2025-09-30 08:00:30 -05:00
parent 74d99db629
commit 72d4a5653d
10 changed files with 1553 additions and 1 deletions

View File

@@ -89,6 +89,12 @@ cremote <command> [options]
- `switch-iframe`: Switch to iframe context for subsequent commands
- `switch-main`: Switch back to main page context
- `list-tabs`: List all open tabs
- `disable-cache`: Disable browser cache for a tab
- `enable-cache`: Enable browser cache for a tab
- `clear-cache`: Clear browser cache for a tab
- `clear-all-site-data`: Clear all site data (cookies, storage, cache, etc.)
- `clear-cookies`: Clear cookies for a tab
- `clear-storage`: Clear web storage (localStorage, sessionStorage, etc.)
- `status`: Check if the daemon is running
### Current Tab Feature
@@ -304,6 +310,43 @@ cremote list-tabs
This will display all open tabs with their IDs and URLs. The current tab is marked with an asterisk (*)
#### Cache and Site Data Management
You can control browser cache and site data for testing, performance optimization, and privacy:
```bash
# Cache Management
# Disable cache for current tab (useful for testing)
cremote disable-cache [--tab="<tab-id>"] [--timeout=5]
# Enable cache for current tab
cremote enable-cache [--tab="<tab-id>"] [--timeout=5]
# Clear browser cache for current tab
cremote clear-cache [--tab="<tab-id>"] [--timeout=5]
# Site Data Management
# Clear ALL site data (cookies, storage, cache, etc.)
cremote clear-all-site-data [--tab="<tab-id>"] [--timeout=10]
# Clear only cookies
cremote clear-cookies [--tab="<tab-id>"] [--timeout=5]
# Clear only web storage (localStorage, sessionStorage, IndexedDB, etc.)
cremote clear-storage [--tab="<tab-id>"] [--timeout=5]
```
**Use Cases:**
- **Testing**: Disable cache to ensure fresh page loads without cached resources
- **Performance Testing**: Clear cache to test cold load performance
- **Debugging**: Clear cache to resolve cache-related issues
- **Development**: Disable cache during development to see changes immediately
- **Authentication Testing**: Clear cookies to test login/logout flows
- **Privacy Testing**: Clear all site data to test clean state scenarios
- **Storage Testing**: Clear web storage to test application state management
The `--timeout` parameter specifies how many seconds to wait for the operation to complete (default: 5 seconds, use longer timeouts for comprehensive data clearing).
### Connecting to a Remote Daemon
By default, the client connects to a daemon running on localhost. To connect to a daemon running on a different host: