You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Python中Selenium+ChromeDriver出现GetHandleVerifier等报错求助

Selenium ChromeDriver 报错(含GetHandleVerifier/BaseThreadInitThunk)解决方案

核心问题排查&修复步骤

  1. 删除重复的Driver初始化代码
    你的代码中连续两次创建ChromeDriver实例,会导致资源占用冲突。删掉try块外的那行driver = webdriver.Chrome(...),只保留try块内的初始化逻辑。

  2. 更新Headless模式参数
    旧版--headless参数存在兼容性问题,替换为新版参数:

    options.add_argument('--headless=new')
    
  3. 添加规避检测与稳定性参数
    给ChromeOptions补充以下参数,减少驱动冲突和网站拦截概率:

    options.add_argument('--no-sandbox')
    options.add_argument('--disable-dev-shm-usage')
    options.add_argument('--disable-extensions')
    options.add_argument('--disable-plugins-discovery')
    options.add_argument('--ignore-certificate-errors')
    options.add_experimental_option('excludeSwitches', ['enable-automation'])
    options.add_experimental_option('useAutomationExtension', False)
    
  4. 手动指定Chrome二进制路径
    如果系统存在多个Chrome版本,强制指定Chrome安装路径,避免版本不匹配:

    # 替换为你本地Chrome的实际安装路径
    options.binary_location = "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe"
    
  5. 使用临时用户目录
    指定临时Chrome用户目录,避免缓存或旧配置干扰:

    import tempfile
    temp_dir = tempfile.mkdtemp()
    options.add_argument(f'--user-data-dir={temp_dir}')
    
  6. 以管理员身份运行脚本
    驱动运行可能存在权限不足问题,右键点击Python脚本,选择「以管理员身份运行」。


原始代码

import os
import tkinter as tk
from tkinter import filedialog
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.service import Service as ChromeService
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from bs4 import BeautifulSoup
from webdriver_manager.chrome import ChromeDriverManager

chromedriver_path = "chromedriver.exe"

def ask_directory():
    root = tk.Tk()
    root.withdraw()  # 隐藏Tkinter主窗口
    folder_selected = filedialog.askdirectory()
    return folder_selected

download_directory = ask_directory()
if not download_directory:
    print("未选择文件夹,程序终止。")
    exit()

options = webdriver.ChromeOptions()
options.add_argument('--headless')
options.add_argument('--disable-gpu')
options.add_argument('--window-size=1024,768')

driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=options)


try:

    driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=options)
    # 访问登录页面
    driver.get('https://plugintheme.net/my-account/')

错误信息

错误 : Message: 
Stacktrace:
        GetHandleVerifier [0x00B30F03+27667]
        (No symbol) [0x00AC6C04]
        (No symbol) [0x009C1AFF]
        (No symbol) [0x00A02BFE]
        (No symbol) [0x00A02CDB]
        (No symbol) [0x00A3EC22]
        (No symbol) [0x00A23974]
        (No symbol) [0x00A3CAC7]
        (No symbol) [0x00A236C6]
        (No symbol) [0x009F74D1]
        (No symbol) [0x009F804D]
        GetHandleVerifier [0x00DE3D83+2857619]
        GetHandleVerifier [0x00E37EED+3202045]
        GetHandleVerifier [0x00BB4704+566292]
        GetHandleVerifier [0x00BBB8FC+595468]
        (No symbol) [0x00ACF9F4]
        (No symbol) [0x00ACC708]
        (No symbol) [0x00ACC8A7]
        (No symbol) [0x00ABE79E]
        BaseThreadInitThunk [0x754F7BA9+25]
        RtlInitializeExceptionChain [0x7740C10B+107]
        RtlClearBits [0x7740C08F+191]

内容的提问来源于stack exchange,提问作者Kilian Giraud

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.22 08:44:52