Docker Selenium:Cursor / RSelenium 与 CRAN selenium 可复制配置资产
scripts/docker-selenium 目录索引:Compose + Tasks 片段
Docker
Selenium
RSelenium
Cursor
Windows
本目录是一套可整体复制到其他 Windows + Cursor 项目的配置资产:用 Docker Compose 启动 Chrome Grid。
- 现行: RSelenium 1.7.9 走 JSON Wire,需已废弃的
selenium/standalone-chrome-debug(profiledebug-legacy)。 - 迁移方向: CRAN
selenium对接 Selenium 4 的standalone-chrome(无头chrome或 profiledebug+ noVNC)。
长文 SOP、端口策略与排障见 Cursor IDE 下 Docker Selenium 可复用工作流。
与 templates/ 的区别:这里是要拷进业务仓的源文件;templates/ 只放消费这些源的微型示例项目(如规划中的 xaringan demo)。
可交付文件
| 本目录文件 | 落到业务仓库 | 说明 |
|---|---|---|
docker-compose.selenium.yml |
docker/docker-compose.selenium.yml |
无头 chrome + debug + debug-legacy;改 name / container_name |
vscode-tasks-selenium.json |
合并进 .vscode/tasks.json,或由 Install-Harness 写成 .vscode/tasks-selenium.json 再合并 |
Cursor Tasks;勿整文件覆盖已有 tasks |
务必修改 Compose 中的 name 与 container_name,避免与其它项目冲突。三套服务都占用主机 5555,不要同时 up。
从 harness 安装到业务项目(推荐)
在 harness 仓库根:
.\scripts\powershell\Install-Harness.ps1 `
-InstallProfile docker-selenium `
-ProjectRoot "D:\path\to\your-repo"将得到:
docker/docker-compose.selenium.yml.vscode/tasks-selenium.json(片段,不会覆盖已有.vscode/tasks.json;请手工合并tasks数组,或在尚无 tasks 时改名为tasks.json)
参数与 profile 说明见 Install-Harness 指南。仍支持手动复制上表路径。
最小操作
前置: Docker Desktop 为 Running。拷贝后把 projectb 换成短名。
RSelenium 1.7.9(现行):
docker compose -f docker/docker-compose.selenium.yml --profile debug-legacy up -d chrome-debug-legacy
curl.exe http://127.0.0.1:5555/wd/hub/statusCRAN selenium / Selenium 4(迁移):
docker compose -f docker/docker-compose.selenium.yml up -d chrome
curl.exe http://127.0.0.1:5555/status拆除本文件拉起的全部 profile(日常:拆容器与网络,保留镜像):
docker compose -f docker/docker-compose.selenium.yml --profile debug --profile debug-legacy down --remove-orphans若确定本机其它项目也不再用这两份镜像、需要腾磁盘:
docker compose -f docker/docker-compose.selenium.yml --profile debug --profile debug-legacy down --remove-orphans --rmi allWindows 请用 curl.exe。新 debug:--profile debug up -d chrome-debug,浏览器打开 http://127.0.0.1:17900/(noVNC)。旧 debug 无 noVNC,VNC 均为 localhost:15900(勿用主机 5901)。
提交规范
- 变更 Compose / Tasks 后同步更新 长文 中的示例块(若仍内嵌)。
- 无本机绝对路径、无账号密钥;VNC 默认密码
secret仅为镜像惯例说明。 - 不在此目录堆业务选择器或登录脚本。