AI Browser 24小时稳定运行指南
AI Browser 24小时稳定运行指南
Acest tutorial prezintă cum să configurăm un mediu stabil și de lungă durată pentru un browser AI.
适用于
- AI Agent
- Automatisare a navigării
- Automatizare web
- Asistent AI
- Sistem de testare automată
目标
- Browser 24 de ore funcționare
- reconectare automată
一、启动 Chrome 调试模式
Mac / Linux
google-chrome \ --remote-debugging-port=9222 \ --user-data-dir=/tmp/ai-browser \ --disable-infobars \ --disable-background-timer-throttling \ --disable-renderer-backgrounding \ --disable-backgrounding-occluded-windows \ --no-first-run \ --no-default-browser-check
Windows
chrome.exe ^ --remote-debugging-port=9222 ^ --user-data-dir=C:\ai-browser ^ --disable-infobars ^ --disable-background-timer-throttling ^ --disable-renderer-backgrounding ^ --disable-backgrounding-occluded-windows ^ --no-first-run ^ --no-default-browser-check
二、为什么这些参数重要
Aceste parametrii pot evita:
- somnul tab-ului
- oprirea temporizatorului JS
- deconectarea automată
三、测试浏览器调试接口
Deschide:
http://localhost:9222 dacă vezi:
DevTools listening on ws://... înseamnă că browserul funcționează normal.
四、配置 agent-browser 自动连接
Creează fișierul de configurare:
Linux / Mac
~/.agent-browser/config.json
Windows
%USERPROFILE%\.agent-browser\config.json conținut:
{ "autoConnect": true, "host": "127.0.0.1", "port": 9222 }
五、测试 AI 控制
Rulează:
agent-browser snapshot dacă returnează arborele DOM: înseamnă că conexiunea a avut succes.
六、稳定导航方法
Recomandat:
agent-browser eval "window.location.href=https://example.com" nu este recomandat:
agent-browser open motiv:
- open poate crea un nou tab
- eval este mai stabil
七、防止浏览器断线
Chrome poate deconecta din următoarele motive:
- Crăparea Chrome
- sesiunea DevTools a fost recuperată
- limitări de resurse ale sistemului
八、Watchdog 脚本
Creează fișierul: watch-browser.sh
#!/bin/bash
while true do if ! curl -s http://localhost:9222 > /dev/null then echo "Chrome nu rulează, repornind..." pkill chrome google-chrome \ --remote-debugging-port=9222 \ --user-data-dir=/tmp/ai-browser \ --disable-infobars \ --no-first-run \ --no-default-browser-check & fi sleep 10 done
Rulează:
bash watch-browser.sh efect:
- Crăparea Chrome se repornește automat
- Portul de depanare se recuperează automat
九、保存登录状态
Pentru că folosește: --user-data-dir
Browserul va salva:
- cookies
- starea de conectare
- stocarea locală
- sesiunea
十、AI 多 Tab 控制
Obține tab-urile curente:
agent-browser list

