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

Python环境下ChromeDriver 115+手动指定路径失败求助(VPN环境)

手动指定ChromeDriver与Chrome路径问题排查(已解决)

已解决说明

  • 根据评论反馈,使用seleniumbase已解决该问题。

问题背景

ChromeDriver升级至115版本后,官方推荐通过以下代码使用管理器自动处理驱动安装:

driver = webdriver.Chrome(service=ChromeService(ChromeDriverManager().install()))

但由于处于VPN环境中,该自动安装的连接被拦截,因此需要手动指定chromedriver和Chrome测试程序的路径,同时希望获取相关文档指引。

尝试的无效代码

已尝试使用绝对路径,但仍无法正常运行,代码如下:

service = Service(executable_path='chromedriver.exe')
options = webdriver.ChromeOptions()
options.binary_location = 'chrome.exe'
driver = webdriver.Chrome(service=service, options=options)

报错信息

Traceback (most recent call last):
  File "C:\Program Files\Python38\lib\code.py", line 90, in runcode
    exec(code, self.locals)
  File "<input>", line 1, in <module>
  File "C:\Users\p3000151\AppData\Local\pypoetry\Cache\virtualenvs\splunk_on_call-xABy5ETk-py3.8\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 49, in __init__
    super().__init__(
  File "C:\Users\p3000151\AppData\Local\pypoetry\Cache\virtualenvs\splunk_on_call-xABy5ETk-py3.8\lib\site-packages\selenium\webdriver\chromium\webdriver.py", line 54, in __init__
    super().__init__(
  File "C:\Users\p3000151\AppData\Local\pypoetry\Cache\virtualenvs\splunk_on_call-xABy5ETk-py3.8\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 206, in __init__
    self.start_session(capabilities)
  File "C:\Users\p3000151\AppData\Local\pypoetry\Cache\virtualenvs\splunk_on_call-xABy5ETk-py3.8\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 291, in start_session
    response = self.execute(Command.NEW_SESSION, caps)["value"]
  File "C:\Users\p3000151\AppData\Local\pypoetry\Cache\virtualenvs\splunk_on_call-xABy5ETk-py3.8\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 346, in execute
    self.error_handler.check_response(response)
  File "C:\Users\p3000151\AppData\Local\pypoetry\Cache\virtualenvs\splunk_on_call-xABy5ETk-py3.8\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 245, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: Failed to create Chrome process.
Stacktrace:
    GetHandleVerifier [0x00007FF7D0DD6F92+54962]
    (No symbol) [0x00007FF7D0D44FF2]
    (No symbol) [0x00007FF7D0BFA6AB]
    (No symbol) [0x00007FF7D0C2702A]
    (No symbol) [0x00007FF7D0C24E5E]
    (No symbol) [0x00007FF7D0C63A5B]
    (No symbol) [0x00007FF7D0C634D0]
    (No symbol) [0x00007FF7D0C5B6E3]
    (No symbol) [0x00007FF7D0C303E1]
    (No symbol) [0x00007FF7D0C31624]
    GetHandleVerifier [0x00007FF7D1129782+3538594]
    GetHandleVerifier [0x00007FF7D117F520+3890240]
    GetHandleVerifier [0x00007FF7D11779DF+3858687]
    GetHandleVerifier [0x00007FF7D0E735B6+695510]
    (No symbol) [0x00007FF7D0D50048]
    (No symbol) [0x00007FF7D0D4C144]
    (No symbol) [0x00007FF7D0D4C272]
    (No symbol) [0x00007FF7D0D3C633]
    BaseThreadInitThunk [0x00007FFDC2167614+20]
    RtlUserThreadStart [0x00007FFDC29426B1+33]

日志信息

[1695134982.210][INFO]: Starting ChromeDriver 118.0.5993.3 (7a51b9ea23325fae1ec1dad5a02c67c2240d7b11-refs/branch-heads/5993@{#7}) on port 60693
[1695134982.210][INFO]: Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
[1695134982.677][INFO]: [86d49340f523de943fea4c30087657ec] COMMAND InitSession {
   "capabilities": {
      "alwaysMatch": {
         "browserName": "chrome",
         "goog:chromeOptions": {
            "args": [  ],
            "binary": "C:\\Users\\p3000151\\PycharmProjects\\SPLUNK ON CALL\\chrome.exe",
            "extensions": [  ]
         },
         "pageLoadStrategy": "normal"
      },
      "firstMatch": [ {
      } ]
   }
}
[1695134982.679][INFO]: Populating Preferences file: {
   "alternate_error_pages": {
      "enabled": false
   },
   "autofill": {
      "enabled": false
   },
   "browser": {
      "check_default_browser": false
   },
   "distribution": {
      "import_bookmarks": false,
      "import_history": false,
      "import_search_engine": false,
      "make_chrome_default_for_user": false,
      "skip_first_run_ui": true
   },
   "dns_prefetching": {
      "enabled": false
   },
   "profile": {
      "content_settings": {
         "pattern_pairs": {
            "https://*,*": {
               "media-stream": {
                  "audio": "Default",
                  "video": "Default"
               }
            }
         }
      },
      "default_content_setting_values": {
         "geolocation": 1
      },
      "default_content_settings": {
         "geolocation": 1,
         "mouselock": 1,
         "notifications": 1,
         "popups": 1,
         "ppapi-broker": 1
      },
      "password_manager_enabled": false
   },
   "safebrowsing": {
      "enabled": false
   },
   "search": {
      "suggest_enabled": false
   },
   "translate": {
      "enabled": false
   }
}
[1695134982.680][INFO]: Populating Local State file: {
   "background_mode": {
      "enabled": false
   },
   "ssl": {
      "rev_checking": {
         "enabled": false
      }
   }
}
[1695134982.686][INFO]: Launching chrome: "C:\Users\p3000151\PycharmProjects\SPLUNK ON CALL\chrome.exe" --allow-pre-commit-input --disable-background-networking --disable-backgrounding-occluded-windows --disable-client-side-phishing-detection --disable-default-apps --disable-hang-monitor --disable-popup-blocking --disable-prompt-on-repost --disable-sync --enable-automation --enable-logging --log-level=0 --no-first-run --no-service-autorun --password-store=basic --remote-debugging-port=0 --test-type=webdriver --use-mock-keychain --user-data-dir="C:\Users\p3000151\AppData\Local\Temp\scoped_dir4444_743592924" data:,
[1695134982.714][INFO]: [86d49340f523de943fea4c30087657ec] RESPONSE InitSession ERROR unknown error: Failed to create Chrome process.

疑问

使用的是win64版本的可执行文件,该问题是否与VPN有关?


内容的提问来源于stack exchange,提问作者Josh Flori

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.10 17:27:01