1
1
mirror of https://github.com/KenanZhu/AutoLibrary.git synced 2026-06-17 23:13:03 +08:00

fix(driver): macOS/Linux 下载的 Chrome/Edge 驱动缺少执行权限导致运行失败

zipfile 解压不保留 Unix 执行位,extract 后 chmod 755;同时在启动检查
时对已下载但不可执行的旧驱动自动修复权限。

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-06-17 10:22:27 +08:00
parent 0bad34d7a8
commit 01f4ccaa0e
2 changed files with 8 additions and 0 deletions
@@ -360,6 +360,10 @@ class WebDriverDownloader:
break break
if not driver_file: if not driver_file:
raise FileNotFoundError(f"未找到 web driver 文件 : {expected_name}") raise FileNotFoundError(f"未找到 web driver 文件 : {expected_name}")
# Ensure executable permissions on Unix systems (zipfile
# extraction does not preserve the execute bit).
if os.name != 'nt':
os.chmod(driver_file, 0o755)
progress_callback(100, 100, 0.0, "解压完成") progress_callback(100, 100, 0.0, "解压完成")
self.download_path.unlink() self.download_path.unlink()
self._cleanup(driver_file) self._cleanup(driver_file)
+4
View File
@@ -111,6 +111,10 @@ class WebDriverManager:
for driver_info in self.__driver_infos: for driver_info in self.__driver_infos:
driver_path = self._getDriverPath(driver_info) driver_path = self._getDriverPath(driver_info)
if driver_path and driver_path.exists() and driver_path.is_file(): if driver_path and driver_path.exists() and driver_path.is_file():
# Repair missing execute permission on Unix
# (zip-extracted drivers from older versions).
if os.name != 'nt' and not os.access(str(driver_path), os.X_OK):
os.chmod(str(driver_path), 0o755)
driver_info.driver_path = driver_path driver_info.driver_path = driver_path
driver_info.driver_status = WebDriverStatus.INSTALLED driver_info.driver_status = WebDriverStatus.INSTALLED