chrome-cdp-cli 1.7.6 → 1.7.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -34
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -119,19 +119,29 @@ npm link
|
|
|
119
119
|
Before using the CLI, start Chrome with remote debugging enabled:
|
|
120
120
|
|
|
121
121
|
```bash
|
|
122
|
-
# Default port (9222)
|
|
123
|
-
chrome --remote-debugging-port=9222
|
|
122
|
+
# Default port (9222) - IMPORTANT: Include --user-data-dir to avoid conflicts
|
|
123
|
+
chrome --remote-debugging-port=9222 --user-data-dir=/tmp/chrome-debug-profile
|
|
124
124
|
|
|
125
125
|
# Custom port
|
|
126
|
-
chrome --remote-debugging-port=9223
|
|
126
|
+
chrome --remote-debugging-port=9223 --user-data-dir=/tmp/chrome-debug-profile
|
|
127
127
|
|
|
128
128
|
# Headless mode
|
|
129
|
-
chrome --headless --remote-debugging-port=9222
|
|
129
|
+
chrome --headless --remote-debugging-port=9222 --user-data-dir=/tmp/chrome-debug-profile
|
|
130
130
|
|
|
131
131
|
# With additional flags for automation
|
|
132
|
-
chrome --remote-debugging-port=9222 --no-first-run --no-default-browser-check
|
|
132
|
+
chrome --remote-debugging-port=9222 --user-data-dir=/tmp/chrome-debug-profile --no-first-run --no-default-browser-check
|
|
133
|
+
|
|
134
|
+
# macOS example with full path and logging
|
|
135
|
+
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222 --user-data-dir=/Users/$USER/chrome-profile-debug > /tmp/chrome.log 2>&1 &
|
|
133
136
|
```
|
|
134
137
|
|
|
138
|
+
**Important Notes:**
|
|
139
|
+
- **Always use `--user-data-dir`**: This creates a separate Chrome profile for debugging and prevents conflicts with your regular Chrome instance
|
|
140
|
+
- **Choose a dedicated directory**: Use a path like `/tmp/chrome-debug-profile` or `/Users/$USER/chrome-profile-debug`
|
|
141
|
+
- **Avoid profile conflicts**: Without `--user-data-dir`, Chrome may fail to open the debugging port if another instance is running
|
|
142
|
+
|
|
143
|
+
For more details, see the [Chrome Remote Debugging documentation](https://developer.chrome.com/blog/remote-debugging-port).
|
|
144
|
+
|
|
135
145
|
## Quick Start
|
|
136
146
|
|
|
137
147
|
```bash
|
|
@@ -1019,18 +1029,26 @@ console.log(result);
|
|
|
1019
1029
|
### Common Issues
|
|
1020
1030
|
|
|
1021
1031
|
1. **Connection Refused**
|
|
1022
|
-
- Ensure Chrome is running with `--remote-debugging-port=9222`
|
|
1032
|
+
- Ensure Chrome is running with `--remote-debugging-port=9222 --user-data-dir=/tmp/chrome-debug`
|
|
1033
|
+
- **Always include `--user-data-dir`** to avoid profile conflicts
|
|
1023
1034
|
- Check if the port is correct and not blocked by firewall
|
|
1035
|
+
- Verify no other Chrome instances are using the same debugging port
|
|
1036
|
+
|
|
1037
|
+
2. **Chrome Won't Start Debugging Port**
|
|
1038
|
+
- **Most common cause**: Missing `--user-data-dir` parameter
|
|
1039
|
+
- **Solution**: Use a dedicated profile directory: `--user-data-dir=/tmp/chrome-debug-profile`
|
|
1040
|
+
- **Why needed**: Prevents conflicts with existing Chrome instances
|
|
1041
|
+
- See [Chrome Remote Debugging documentation](https://developer.chrome.com/blog/remote-debugging-port) for details
|
|
1024
1042
|
|
|
1025
|
-
|
|
1043
|
+
3. **Command Timeout**
|
|
1026
1044
|
- Increase timeout with `--timeout` option
|
|
1027
1045
|
- Check if the page is responsive
|
|
1028
1046
|
|
|
1029
|
-
|
|
1047
|
+
4. **Element Not Found**
|
|
1030
1048
|
- Verify CSS selectors are correct
|
|
1031
1049
|
- Use `wait_for` command to wait for dynamic elements
|
|
1032
1050
|
|
|
1033
|
-
|
|
1051
|
+
5. **Permission Denied**
|
|
1034
1052
|
- Ensure Chrome has necessary permissions
|
|
1035
1053
|
- Check file system permissions for screenshot output
|
|
1036
1054
|
|
|
@@ -1052,31 +1070,6 @@ npm run package
|
|
|
1052
1070
|
npm run prepublishOnly
|
|
1053
1071
|
```
|
|
1054
1072
|
|
|
1055
|
-
## Publishing to npm
|
|
1056
|
-
|
|
1057
|
-
To make this tool available via `npx`, you need to publish it to npm:
|
|
1058
|
-
|
|
1059
|
-
```bash
|
|
1060
|
-
# 1. Login to npm (one time setup)
|
|
1061
|
-
npm login
|
|
1062
|
-
|
|
1063
|
-
# 2. Publish the package
|
|
1064
|
-
npm publish
|
|
1065
|
-
|
|
1066
|
-
# 3. Users can then use it with npx
|
|
1067
|
-
npx chrome-cdp-cli eval "document.title"
|
|
1068
|
-
```
|
|
1069
|
-
|
|
1070
|
-
**Note**: The package name `chrome-cdp-cli` uses a clean, descriptive approach. This approach:
|
|
1071
|
-
|
|
1072
|
-
- ✅ **Professional naming** that clearly indicates Chrome DevTools Protocol CLI
|
|
1073
|
-
- ✅ **Works with npx**: `npx chrome-cdp-cli eval "document.title"`
|
|
1074
|
-
- ✅ **Simple installation**: `npm install -g chrome-cdp-cli`
|
|
1075
|
-
- ✅ **Short and memorable** compared to longer alternatives
|
|
1076
|
-
|
|
1077
|
-
Alternative naming examples:
|
|
1078
|
-
1. **Scoped name**: `@nickxiao42/chrome-devtools-cli`
|
|
1079
|
-
2. **Longer descriptive**: `chrome-automation-cli`
|
|
1080
1073
|
|
|
1081
1074
|
## Contributing
|
|
1082
1075
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "chrome-cdp-cli",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.7",
|
|
4
4
|
"description": "Browser automation CLI via Chrome DevTools Protocol. Designed for developers and AI assistants - combines dedicated commands for common tasks with flexible JavaScript execution for complex scenarios. Features: element interaction, screenshots, DOM snapshots, console/network monitoring. Built-in IDE integration for Cursor and Claude.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"prepublishOnly": "npm run test:ci && npm run build:prod",
|
|
36
36
|
"prepack": "npm run build:prod",
|
|
37
37
|
"verify": "npm run lint && npm run test:ci && npm run build:prod",
|
|
38
|
-
"postinstall": "node -e \"console.log('\\n🎉 chrome-cdp-cli installed successfully!\\n\\n📋 Quick Start:\\n 1. Start Chrome with debugging: chrome --remote-debugging-port=9222\\n 2. Try: chrome-cdp-cli eval \\\"document.title\\\"\\n 3. Get help: chrome-cdp-cli --help\\n\\n🔗 More info: https://github.com/nicoster/chrome-devtools-cli\\n')\""
|
|
38
|
+
"postinstall": "node -e \"console.log('\\n🎉 chrome-cdp-cli installed successfully!\\n\\n📋 Quick Start:\\n 1. Start Chrome with debugging: chrome --remote-debugging-port=9222 --user-data-dir=/tmp/chrome-debug\\n 2. Try: chrome-cdp-cli eval \\\"document.title\\\"\\n 3. Get help: chrome-cdp-cli --help\\n\\n🔗 More info: https://github.com/nicoster/chrome-devtools-cli\\n')\""
|
|
39
39
|
},
|
|
40
40
|
"keywords": [
|
|
41
41
|
"chrome",
|