Google Search (WSL Chrome)
Perform Google searches through Chrome browser in WSL.
Prerequisites
google-chrome-stableorgoogle-chromeinstalled in WSL- WSLg available (or X11 forwarding configured)
- OpenClaw browser tool enabled
Quick Start
1. Launch Chrome
Run the startup script:
bash ~/.openclaw/scripts/google-search-chrome.sh
Or start manually:
export DISPLAY=:0
google-chrome-stable --remote-debugging-port=9222 \
--remote-allow-origins='*' \
--user-data-dir="$HOME/.openclaw/chrome-debug-profile" \
--lang=zh-CN \
--disable-gpu \
--disable-dev-shm-usage &
2. Verify Chrome is Running
curl -s http://127.0.0.1:9222/json/version
Should return Chrome version information.
3. Search Using Browser Tool
browser action=open url="https://www.google.com/search?q=your+search+term" profile=user
browser action=snapshot targetId=<returned-targetId>
Troubleshooting
Chrome Won't Start (Missing X server)
Ensure WSLg is available, or set the DISPLAY environment variable:
export DISPLAY=:0
# Or check WSLg
ls /mnt/wslg/.X11-unix/
Port 9222 Already in Use
Check and kill the occupying process:
lsof -i :9222
kill <PID>
Empty Search Results
- Check network connection
- Try using a proxy (if
HTTP_PROXYis configured) - Wait for the page to fully load before taking a snapshot
Tips
- Chinese keywords in search URLs will be automatically encoded
- Use
snapshotto get page content, then extract the needed information - For news search, use the
tbm=nwsparameter:/search?q=keyword&tbm=nws
微信扫一扫