Skip to main content

自动检测环境并从 dreamshao/chromedriver 下载对应驱动的工具

Project description

🚀 ChromeDriver Sync Manager

ChromeDriver Sync 是一个轻量级的 Python 工具,旨在解决自动化测试中最头疼的问题:Chrome 浏览器与驱动版本不匹配

它会自动检测你电脑上安装的 Chrome 版本和系统架构(Windows/Mac/Linux),并从 dreamshao/chromedriver 镜像仓库中精准下载对应的驱动文件。


✨ 核心特性

  • 智能检测:自动识别本地 Chrome 版本(支持 v115+ 后的新架构)。
  • 全平台支持:支持 Windows (32/64)、macOS (Intel/M1/M2/M3)、Linux (64位)。
  • 交互式补救:如果找不到完全匹配的版本,会询问是否尝试下载最新的稳定版。
  • 速度优势:专为国内开发者优化,避开 Google 官方源连接不稳定的问题。

📦 安装方式

通过 pip 即可一键安装:

pip install chromedriver-sync

🛠 使用方法

安装完成后,直接在你的终端(Terminal/Command Prompt)输入以下命令:

chromedriver-sync

运行效果展示

  1. 自动匹配:程序会输出 检测到系统平台: mac-arm64检测到 Chrome 版本: 121
  2. 自动下载:匹配成功后自动下载压缩包。
  3. 解压就绪:驱动会解压到当前执行命令的目录下,你可以直接在代码中引用。

🐍 在 Python 代码中调用

如果你想在代码运行初期自动更新驱动,可以这样集成:

from chromedriver_sync.main import sync

# 运行同步逻辑,确保驱动是最新的
sync()

# 接下来启动你的 Selenium
from selenium import webdriver
driver = webdriver.Chrome()

❓ 常见问题 (FAQ)

Q: 为什么我运行后提示“未找到匹配版本”? A: 这通常是因为你的 Chrome 刚刚更新,而官方驱动尚未发布。此时输入 y 下载仓库中最新的版本,通常是可以向下兼容的。

Q: 如何将驱动安装到系统路径? A: 建议将下载后的 chromedriver 移动到 /usr/local/bin (Mac/Linux) 或将其所在文件夹添加到 Windows 的 PATH 环境变量中。


🌟 贡献与支持

如果你觉得这个工具有帮到你,请给 dreamshao/chromedriver 点一个 Star ⭐!这也是我持续更新驱动版本的动力。

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

chromedriver_sync-1.0.1.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

chromedriver_sync-1.0.1-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file chromedriver_sync-1.0.1.tar.gz.

File metadata

  • Download URL: chromedriver_sync-1.0.1.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for chromedriver_sync-1.0.1.tar.gz
Algorithm Hash digest
SHA256 ac9635623caffc5738666ea0055da78b7947aa3dc05df65beba33885afa99c6f
MD5 7c44d52b91daf385cdf53c3a6259dab0
BLAKE2b-256 95e2266015a6c8f687d546888d03828c0e6e550b6c95fb10a1cfe7940f0dfdd2

See more details on using hashes here.

File details

Details for the file chromedriver_sync-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for chromedriver_sync-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bc92c8a0e15dd2e8630a167e9a7e782b1820cd549abff207585a7cad1817ac06
MD5 880c3ccc73b0d4716ac2cb9a028a42bb
BLAKE2b-256 401743c1f1d07390c193d3dc66c562a0a9e668009f98fe4471e2e7fd6fb4bdbf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page