1
gchuyun 2023-08-08 22:27:01 +08:00 via iPhone
docker
|
2
WildCat 2023-08-08 22:36:22 +08:00 via iPhone
Use plauwright
|
3
sardina 2023-08-08 23:11:18 +08:00 via iPhone
FROM alpine:latest
RUN apk upgrade --no-cache --available \ && apk add --no-cache \ chromium-swiftshader \ ttf-freefont \ font-noto-emoji \ gcompat \ && apk add --no-cache \ --repository=https://dl-cdn.alpinelinux.org/alpine/edge/testing \ font-wqy-zenhei COPY local.conf /etc/fonts/local.conf ENV CHROME_BIN=/usr/bin/chromium |
4
yaleyu 2023-08-09 09:24:52 +08:00 1
为啥不更新 chromedriver 呢?还不用保留两份不同版本的 Chrome
|
5
NonClockworkChen OP @yaleyu 谢谢原来 b 站教程给的不是官方下载地址,官方有 115 版本的
|
7
yaleyu 2023-08-09 21:44:31 +08:00 1
@NonClockworkChen 115 开始,官方版本在这里 https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions-with-downloads.json ,手动下载和 Chrome 一致的版本,或者安装 pip install webdriver_manager 4.0 后可以通过下面脚本自动和 Chrome 版本保持一致
import os import sys from webdriver_manager.core.utils import read_version_from_cmd from webdriver_manager.core.os_manager import PATTERN from webdriver_manager.chrome import ChromeDriverManager if sys.platform == 'linux': chrome_path = '/usr/bin/google-chrome' elif sys.platform == 'darwin': chrome_path = '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome' ver = read_version_from_cmd(f'"{chrome_path}" --version', PATTERN['google-chrome']).split('.')[0] if sys.platform == 'linux': driver_path = f'{os.environ["HOME"]}/.wdm/drivers/chromedriver/linux64/{ver}/chromedriver-linux64/chromedriver' elif sys.platform == 'darwin': driver_path = f'{os.environ["HOME"]}/.wdm/drivers/chromedriver/mac64/{ver}/chromedriver-mac-x64/chromedriver' if not os.path.exists(driver_path): ChromeDriverManager(ver).install() |
8
NonClockworkChen OP @yaleyu 感谢感谢
|