Skip to content

Latest commit

 

History

History
52 lines (35 loc) · 1.74 KB

File metadata and controls

52 lines (35 loc) · 1.74 KB

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

專案概述

此專案打包一個 Docker 映像檔,提供固定版本的 Chrome 68 + ChromeDriver + Selenium Standalone Server,供需要舊版瀏覽器相容性測試的場景使用。映像名稱為 acrool/selenium-chrome:linux64-68,僅支援 linux/amd64 平台。

常用指令

# 建置映像
docker compose build

# 啟動容器(背景執行)
docker compose up -d

# 停止容器
docker compose down

# 驗證 Selenium Session 是否正常
bash session.sh

服務端口

端口 用途
4444 Selenium WebDriver Hub(http://localhost:4444/wd/hub
7900 noVNC 瀏覽器視覺化介面(http://localhost:7900

架構說明

容器啟動後由 start.sh 依序啟動:

  1. Xvfb — 虛擬顯示器(:99,1280×720)
  2. Fluxbox — 輕量視窗管理器
  3. x11vnc — VNC Server(port 5900,無密碼)
  4. websockify + noVNC — 將 VNC 轉為 WebSocket,可從瀏覽器即時觀看 Chrome 操作
  5. Selenium Standalone Server 3.141.59 — 監聽 port 4444

靜態資源(assets/

這些檔案需在 build 前備妥,不會自動下載:

  • google-chrome-stable_68.0.3440.75-1_amd64.deb — 透過 Git LFS 管理
  • chromedriver_linux64.zip — ChromeDriver for Chrome 68(linux64)
  • selenium-server-standalone-3.141.59.jar — Selenium Standalone

注意:克隆後需執行 git lfs pull 才能取得 .deb 檔案。

WebDriver 連線設定

Selenium session 需使用 desiredCapabilities(舊版 JSON Wire Protocol),ChromeDriver 路徑固定為 /opt/google/chrome/google-chrome。詳見 session.sh