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.0.tar.gz (4.4 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.0-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: chromedriver_sync-1.0.0.tar.gz
  • Upload date:
  • Size: 4.4 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.0.tar.gz
Algorithm Hash digest
SHA256 414258e9233fbd3a9fbb7f914e2530ce127aa97efaf49395c80bdc538b1cccfa
MD5 5e34ce0bf1c4cc7bc1199d9fff17d940
BLAKE2b-256 080170c8c078dcffcc78c5adf0cb6c33f81f045fb28eb01b111ea65ac5c91102

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for chromedriver_sync-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4d5c19f132cfbeb54049f3e6ef5608332766c01d3d14524cd42c67246f5c064d
MD5 e9e2746f364457ab6b1adeeac791533b
BLAKE2b-256 b0dfe2c445560162e37d56a37bc4a312de4b0f8a9ffd9335a8cfee20aef5dd5e

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