selenium_keyan/selenium
jinzeying 80b80940c6 合并子仓库为普通文件夹,并重新添加所有文件 2025-09-25 19:42:04 +08:00
..
__pycache__ 合并子仓库为普通文件夹,并重新添加所有文件 2025-09-25 19:42:04 +08:00
chrome 合并子仓库为普通文件夹,并重新添加所有文件 2025-09-25 19:42:04 +08:00
parseApi 合并子仓库为普通文件夹,并重新添加所有文件 2025-09-25 19:42:04 +08:00
utils 合并子仓库为普通文件夹,并重新添加所有文件 2025-09-25 19:42:04 +08:00
Dockerfile 合并子仓库为普通文件夹,并重新添加所有文件 2025-09-25 19:42:04 +08:00
config.py 合并子仓库为普通文件夹,并重新添加所有文件 2025-09-25 19:42:04 +08:00
entrypoint.sh 合并子仓库为普通文件夹,并重新添加所有文件 2025-09-25 19:42:04 +08:00
main.py 合并子仓库为普通文件夹,并重新添加所有文件 2025-09-25 19:42:04 +08:00
readme 合并子仓库为普通文件夹,并重新添加所有文件 2025-09-25 19:42:04 +08:00
requirements.txt 合并子仓库为普通文件夹,并重新添加所有文件 2025-09-25 19:42:04 +08:00

readme

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

1.安装浏览器(命令如下)

wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo apt install ./google-chrome-stable_current_amd64.deb -y

2.下载成功之后,输入命令

google-chrome --version
# 输出示例Google Chrome 140.0.7339.80

3.下载对应 ChromeDriver
访问网站 https://googlechromelabs.github.io/chrome-for-testing/
根据上一步google-chrome输出的版本号信息选择相同的版本 示例如下:
wget https://storage.googleapis.com/chrome-for-testing-public/140.0.7339.80/linux64/chromedriver-linux64.zip
unzip chromedriver_linux64.zip
cd chromedriver_linux64
sudo mv chromedriver /usr/local/bin/
sudo chmod +x /usr/local/bin/chromedriver
然后验证
chromedriver --version
# 输出示例ChromeDriver 140.0.7339.80 (670b6f192f4668d2ac2c06bd77ec3e4eeda7d648-refs/branch-heads/7339_41@{#3})

4.下载这个xvfb-run,运行示例
xvfb-run python main.py



第一步构建镜像
docker build -t selenium:latest .
第二步启动容器:
docker run -d \
  --name selenium-container \
  -p 5001:5000 \
  selenium